Spaces:
Sleeping
Sleeping
Update inference_app.py
Browse files- inference_app.py +7 -2
inference_app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
|
| 2 |
import time
|
|
|
|
| 3 |
|
| 4 |
import gradio as gr
|
| 5 |
|
|
@@ -12,9 +13,11 @@ def predict (input_seq_1, input_msa_1, input_protein_1, input_seq_2,input_msa_2,
|
|
| 12 |
start_time = time.time()
|
| 13 |
# Do inference here
|
| 14 |
# return an output pdb file with the protein and two chains A and B.
|
|
|
|
|
|
|
| 15 |
end_time = time.time()
|
| 16 |
run_time = end_time - start_time
|
| 17 |
-
return "test_out.pdb", run_time
|
| 18 |
|
| 19 |
with gr.Blocks() as app:
|
| 20 |
|
|
@@ -82,10 +85,12 @@ with gr.Blocks() as app:
|
|
| 82 |
"color": "greenCarbon"
|
| 83 |
}
|
| 84 |
]
|
|
|
|
| 85 |
|
| 86 |
out = Molecule3D(reps=reps)
|
|
|
|
| 87 |
run_time = gr.Textbox(label="Runtime")
|
| 88 |
|
| 89 |
-
btn.click(predict, inputs=[input_seq_1, input_msa_1, input_protein_1, input_seq_2, input_msa_2, input_protein_2], outputs=[out, run_time])
|
| 90 |
|
| 91 |
app.launch()
|
|
|
|
| 1 |
|
| 2 |
import time
|
| 3 |
+
import json
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
|
|
|
|
| 13 |
start_time = time.time()
|
| 14 |
# Do inference here
|
| 15 |
# return an output pdb file with the protein and two chains A and B.
|
| 16 |
+
# also return a JSON with any metrics you want to report
|
| 17 |
+
metrics = {"mean_plddt": 80, "binding_affinity": 2}
|
| 18 |
end_time = time.time()
|
| 19 |
run_time = end_time - start_time
|
| 20 |
+
return "test_out.pdb",json.dumps(metrics), run_time
|
| 21 |
|
| 22 |
with gr.Blocks() as app:
|
| 23 |
|
|
|
|
| 85 |
"color": "greenCarbon"
|
| 86 |
}
|
| 87 |
]
|
| 88 |
+
# outputs
|
| 89 |
|
| 90 |
out = Molecule3D(reps=reps)
|
| 91 |
+
metrics = gr.JSON(label="Metrics")
|
| 92 |
run_time = gr.Textbox(label="Runtime")
|
| 93 |
|
| 94 |
+
btn.click(predict, inputs=[input_seq_1, input_msa_1, input_protein_1, input_seq_2, input_msa_2, input_protein_2], outputs=[out, metrics, run_time])
|
| 95 |
|
| 96 |
app.launch()
|