Spaces:
Runtime error
Runtime error
Take attention on task state
Browse files
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 |
-
|
84 |
-
|
|
|
|
|
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)
|