lucaslingle commited on
Commit
360ff21
·
verified ·
1 Parent(s): 5fb922b

Update app.py

Browse files

add catch for "504 Server Error: Gateway Time-out"

Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -173,9 +173,13 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
173
  print(f"Skipping item with missing task_id or question: {item}")
174
  continue
175
  try:
176
- submitted_answer = agent(question_text, file_name)
177
- answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
178
- results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
 
 
 
 
179
  except Exception as e:
180
  print(f"Error running agent on task {task_id}: {e}")
181
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
 
173
  print(f"Skipping item with missing task_id or question: {item}")
174
  continue
175
  try:
176
+ answer = agent(question_text, file_name)
177
+ if answer.startswith("Error in generating final LLM output: 504 Server Error: Gateway Time-out for"):
178
+ print(f"Error running agent on task {task_id}: {submitted_answer}")
179
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {answer}"})
180
+ else:
181
+ answers_payload.append({"task_id": task_id, "submitted_answer": answer})
182
+ results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": answer})
183
  except Exception as e:
184
  print(f"Error running agent on task {task_id}: {e}")
185
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})