Update app.py
Browse files
app.py
CHANGED
@@ -207,6 +207,11 @@ def infer(request: gr.Request):
|
|
207 |
|
208 |
# Update the task status to Successed with result
|
209 |
update_task_status('img2text', task['id'], 'Successed', {"text": parsed_answer})
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
return "No pending tasks found."
|
212 |
|
|
|
207 |
|
208 |
# Update the task status to Successed with result
|
209 |
update_task_status('img2text', task['id'], 'Successed', {"text": parsed_answer})
|
210 |
+
except Exception as e:
|
211 |
+
print(f"Error processing task {task['id']}: {e}")
|
212 |
+
# If error occurs, update the task status to Failed
|
213 |
+
update_task_status('img2text', task['id'], 'Failed')
|
214 |
+
return f"Error processing task {task['id']}: {e}"
|
215 |
|
216 |
return "No pending tasks found."
|
217 |
|