bshor commited on
Commit
e700082
·
1 Parent(s): 3f88de2
Files changed (1) hide show
  1. 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
- # Do inference here
14
- # return an output pdb file with the protein and ligand with resname LIG or UNK.
15
- # also return any metrics you want to log, metrics will not be used for evaluation but might be useful for users
16
- ckpt_path = MODEL_NAME_TO_CKPT[model_variation]
17
- metrics = run_on_sample_seqs(input_sequence, input_protein, input_ligand, OUTPUT_PROT_PATH, OUTPUT_LIG_PATH,
18
- RUN_CONFIG_PATH, ckpt_path)
19
- end_time = time.time()
20
- run_time = end_time - start_time
21
-
22
- return [OUTPUT_PROT_PATH, OUTPUT_LIG_PATH], metrics, run_time
 
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: