Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ from transformers.models.esm.openfold_utils.protein import to_pdb, Protein as OF
|
|
3 |
from transformers.models.esm.openfold_utils.feats import atom14_to_atom37
|
4 |
from proteins_viz import *
|
5 |
import gradio as gr
|
6 |
-
|
7 |
|
8 |
def convert_outputs_to_pdb(outputs):
|
9 |
final_atom_positions = atom14_to_atom37(outputs["positions"][-1], outputs)
|
@@ -40,7 +40,7 @@ torch.backends.cuda.matmul.allow_tf32 = True
|
|
40 |
|
41 |
model.trunk.set_chunk_size(64)
|
42 |
|
43 |
-
|
44 |
def fold_protein(test_protein):
|
45 |
tokenized_input = tokenizer([test_protein], return_tensors="pt", add_special_tokens=False)['input_ids']
|
46 |
tokenized_input = tokenized_input.cuda()
|
@@ -55,8 +55,18 @@ def fold_protein(test_protein):
|
|
55 |
iface = gr.Interface(
|
56 |
title="everything-ai-proteinfold",
|
57 |
fn=fold_protein,
|
58 |
-
inputs=
|
59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
)
|
61 |
|
62 |
-
iface.launch(server_name="0.0.0.0", share=False)
|
|
|
3 |
from transformers.models.esm.openfold_utils.feats import atom14_to_atom37
|
4 |
from proteins_viz import *
|
5 |
import gradio as gr
|
6 |
+
|
7 |
|
8 |
def convert_outputs_to_pdb(outputs):
|
9 |
final_atom_positions = atom14_to_atom37(outputs["positions"][-1], outputs)
|
|
|
40 |
|
41 |
model.trunk.set_chunk_size(64)
|
42 |
|
43 |
+
|
44 |
def fold_protein(test_protein):
|
45 |
tokenized_input = tokenizer([test_protein], return_tensors="pt", add_special_tokens=False)['input_ids']
|
46 |
tokenized_input = tokenized_input.cuda()
|
|
|
55 |
iface = gr.Interface(
|
56 |
title="everything-ai-proteinfold",
|
57 |
fn=fold_protein,
|
58 |
+
inputs=gr.Textbox(
|
59 |
+
label="Protein Sequence",
|
60 |
+
info="Find sequences examples below, and complete examples with images at: https://github.com/AstraBert/proteinviz/tree/main/examples.md; if you input a sequence, you're gonna get the static image and the HTML file with the 3D model to explore and play with",
|
61 |
+
lines=50,
|
62 |
+
value=f"Paste or write amino-acidic sequence here",
|
63 |
+
),
|
64 |
+
outputs=[gr.Image(label="Protein static image"), gr.File(label="Protein 3D model HTML")],
|
65 |
+
examples=[
|
66 |
+
{"sequence": "MVHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGNPKVKAHGKKVLGAFSDGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVCVLAHHFGKEFTPPVQAAYQKVVAGVANALAHKYH"},
|
67 |
+
{"sequence": "MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAGQEEYSAMRDQYMRTGEGFLCVFAINNTKSFEDIHQYREQIKRVKDSDDVPMVLVGNKCDLAARTVESRQAQDLARSYGIPYIETSAKTRQGVEDAFYTLVREIRQHKLRKLNPPDESGPGCMSCKCVLS"},
|
68 |
+
{"sequence": "MQIFVKTLTGKTITLEVEPSDTIENVKAKIQDKEGIPPDQQRLIFAGKQLEDGRTLSDYNIQKESTLHLVLRLRGG"},
|
69 |
+
]
|
70 |
)
|
71 |
|
72 |
+
iface.launch(server_name="0.0.0.0", share=False)
|