Spaces:
Running
Running
add logs
Browse files- inference_app.py +12 -10
inference_app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import time
|
|
|
2 |
|
3 |
import gradio as gr
|
4 |
|
@@ -10,16 +11,17 @@ from env_consts import RUN_CONFIG_PATH, OUTPUT_PROT_PATH, OUTPUT_LIG_PATH, MODEL
|
|
10 |
def predict(input_sequence, input_ligand, input_protein, model_variation):
|
11 |
print("Strating inference!!!!!!!!!!!!!!!!!", input_sequence, input_ligand, input_protein)
|
12 |
start_time = time.time()
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
23 |
|
24 |
|
25 |
with gr.Blocks() as app:
|
|
|
1 |
import time
|
2 |
+
import traceback
|
3 |
|
4 |
import gradio as gr
|
5 |
|
|
|
11 |
def predict(input_sequence, input_ligand, input_protein, model_variation):
|
12 |
print("Strating inference!!!!!!!!!!!!!!!!!", input_sequence, input_ligand, input_protein)
|
13 |
start_time = time.time()
|
14 |
+
try:
|
15 |
+
ckpt_path = MODEL_NAME_TO_CKPT[model_variation]
|
16 |
+
metrics = run_on_sample_seqs(input_sequence, input_protein, input_ligand, OUTPUT_PROT_PATH, OUTPUT_LIG_PATH,
|
17 |
+
RUN_CONFIG_PATH, ckpt_path)
|
18 |
+
end_time = time.time()
|
19 |
+
run_time = end_time - start_time
|
20 |
+
return [OUTPUT_PROT_PATH, OUTPUT_LIG_PATH], metrics, run_time
|
21 |
+
except Exception as e:
|
22 |
+
print(f"Error during inference: {e}")
|
23 |
+
traceback.print_exc() # Print the full traceback
|
24 |
+
return None, {"error": str(e)}, "Error occurred" # return error message to the output.
|
25 |
|
26 |
|
27 |
with gr.Blocks() as app:
|