Spaces:
Paused
Paused
Commit
·
6d03390
1
Parent(s):
f591191
Update app.py
Browse files
app.py
CHANGED
@@ -66,6 +66,8 @@ def molecule(input_pdb):
|
|
66 |
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
|
67 |
allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
|
68 |
|
|
|
|
|
69 |
|
70 |
def update(sequence=DEFAULT_SEQ):
|
71 |
headers = {
|
@@ -76,10 +78,10 @@ def update(sequence=DEFAULT_SEQ):
|
|
76 |
name = sequence[:3] + sequence[-3:]
|
77 |
pdb_filename = "test.pdb"
|
78 |
pdb_string = response.content.decode('utf-8')
|
79 |
-
with
|
80 |
-
|
81 |
|
82 |
-
return molecule(
|
83 |
|
84 |
|
85 |
def suggest(option):
|
@@ -120,9 +122,13 @@ with demo:
|
|
120 |
name = gr.Dropdown(label="Choose a Sample Protein", value="Plastic degradation protein", choices=["Antifreeze protein", "Plastic degradation protein", "AI Generated protein", "7-bladed propeller fold", "custom"])
|
121 |
with gr.Row():
|
122 |
inp = gr.Textbox(label="Protein sequence", lines=3, value=DEFAULT_SEQ, placeholder="Write your protein sequence here...")
|
123 |
-
|
|
|
|
|
|
|
|
|
124 |
mol = gr.HTML(update)
|
125 |
-
btn.click(fn=update, inputs=inp, outputs=mol)
|
126 |
|
127 |
name.change(fn=suggest, inputs=name, outputs=inp)
|
128 |
name.change(fn=lambda :"", inputs=None, outputs=mol)
|
|
|
66 |
allow-top-navigation-by-user-activation allow-downloads" allowfullscreen=""
|
67 |
allowpaymentrequest="" frameborder="0" srcdoc='{x}'></iframe>"""
|
68 |
|
69 |
+
import tempfile
|
70 |
+
|
71 |
|
72 |
def update(sequence=DEFAULT_SEQ):
|
73 |
headers = {
|
|
|
78 |
name = sequence[:3] + sequence[-3:]
|
79 |
pdb_filename = "test.pdb"
|
80 |
pdb_string = response.content.decode('utf-8')
|
81 |
+
with tempfile.NamedTemporaryFile() as tmp:
|
82 |
+
tmp.write(pdb_string)
|
83 |
|
84 |
+
return molecule(tmp.name), tmp.name
|
85 |
|
86 |
|
87 |
def suggest(option):
|
|
|
122 |
name = gr.Dropdown(label="Choose a Sample Protein", value="Plastic degradation protein", choices=["Antifreeze protein", "Plastic degradation protein", "AI Generated protein", "7-bladed propeller fold", "custom"])
|
123 |
with gr.Row():
|
124 |
inp = gr.Textbox(label="Protein sequence", lines=3, value=DEFAULT_SEQ, placeholder="Write your protein sequence here...")
|
125 |
+
with gr.Column():
|
126 |
+
with gr.Row():
|
127 |
+
btn = gr.Button("🔬 Predict Structure ").style(full_width=False)
|
128 |
+
with gr.Row():
|
129 |
+
download = gr.File(label="Download file")
|
130 |
mol = gr.HTML(update)
|
131 |
+
btn.click(fn=update, inputs=inp, outputs=[mol, download])
|
132 |
|
133 |
name.change(fn=suggest, inputs=name, outputs=inp)
|
134 |
name.change(fn=lambda :"", inputs=None, outputs=mol)
|