idolezal commited on
Commit
822c3a6
β€’
1 Parent(s): 48c616c

Take attention on task state

Browse files
Files changed (1) hide show
  1. server.py +5 -3
server.py CHANGED
@@ -79,9 +79,11 @@ def check_significance_wait_for_result(result_url):
79
  time.sleep(5)
80
  else:
81
  raise RuntimeError(f'Failed to get result. Status code: {response.status_code}') # TODO: try-except do raise gr.error
82
-
83
- print(result)
84
- return result['result']
 
 
85
 
86
  def check_significance(model_a_path, model_b_path):
87
  result_url = check_significance_send_task(model_a_path, model_b_path)
 
79
  time.sleep(5)
80
  else:
81
  raise RuntimeError(f'Failed to get result. Status code: {response.status_code}') # TODO: try-except do raise gr.error
82
+
83
+ if result["state"] == "COMPLETED":
84
+ return result['result']
85
+ else:
86
+ raise RuntimeError(result['result']['error'])
87
 
88
  def check_significance(model_a_path, model_b_path):
89
  result_url = check_significance_send_task(model_a_path, model_b_path)