Nerva1228 commited on
Commit
d4e2f52
·
verified ·
1 Parent(s): 8519f94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
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