foleymon commited on
Commit
30b2b31
·
verified ·
1 Parent(s): 129dbb0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -230,7 +230,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
230
  # 1. Instantiate Agent ( modify this part to create your agent)
231
  try:
232
  agent = BasicAgent()
233
- except Exception as e:
234
  print(f"Error instantiating agent: {e}")
235
  return f"Error initializing agent: {e}", None
236
 
@@ -248,13 +248,13 @@ except Exception as e:
248
  print("Fetched questions list is empty.")
249
  return "Fetched questions list is empty or invalid format.", None
250
  print(f"Fetched {len(questions_data)} questions.")
251
- except requests.exceptions.RequestException as e:
252
  print(f"Error fetching questions: {e}")
253
  return f"Error fetching questions: {e}", None
254
- except requests.exceptions.JSONDecodeError as e:
255
  print(f"Error decoding JSON response of questions: {e}")
256
  return f"Error decoding JSON response of questions: {e}", None
257
- except Exception as e:
258
  print(f"Unexpected error fetching questions: {e}")
259
  return f"Unexpected error fetching questions: {e}", None
260
 
@@ -365,7 +365,7 @@ except Exception as e:
365
  response = requests.post(submit_url, json=payload, timeout=60)
366
  response.raise_for_status()
367
  result_data = response.json()
368
- except requests.exceptions.HTTPError as e:
369
  error_detail = f"HTTP Error: {e}"
370
  try:
371
  error_json = response.json()
@@ -397,13 +397,13 @@ except requests.exceptions.HTTPError as e:
397
 
398
 
399
 
400
- except requests.exceptions.RequestException as e:
401
  print(f"Error submitting answers: {e}")
402
  return f"Error submitting answers: {e}", pd.DataFrame(results_log)
403
- except requests.exceptions.JSONDecodeError as e:
404
  print(f"Error decoding JSON response of submission: {e}")
405
  return f"Error decoding JSON response of submission: {e}", pd.DataFrame(results_log)
406
- except Exception as e:
407
  print(f"Unexpected error submitting answers: {e}")
408
  return f"Unexpected error submitting answers: {e}", pd.DataFrame(results_log)
409
 
@@ -417,7 +417,7 @@ except Exception as e:
417
  )
418
  print(status_message)
419
  return status_message, pd.DataFrame(results_log)
420
- except Exception as e:
421
  print(f"Error formatting submission results: {e}")
422
  return f"Submission worked but formatting failed: {e}\nRaw data: {result_data}", pd.DataFrame(results_log)
423
 
 
230
  # 1. Instantiate Agent ( modify this part to create your agent)
231
  try:
232
  agent = BasicAgent()
233
+ except Exception as e:
234
  print(f"Error instantiating agent: {e}")
235
  return f"Error initializing agent: {e}", None
236
 
 
248
  print("Fetched questions list is empty.")
249
  return "Fetched questions list is empty or invalid format.", None
250
  print(f"Fetched {len(questions_data)} questions.")
251
+ except requests.exceptions.RequestException as e:
252
  print(f"Error fetching questions: {e}")
253
  return f"Error fetching questions: {e}", None
254
+ except requests.exceptions.JSONDecodeError as e:
255
  print(f"Error decoding JSON response of questions: {e}")
256
  return f"Error decoding JSON response of questions: {e}", None
257
+ except Exception as e:
258
  print(f"Unexpected error fetching questions: {e}")
259
  return f"Unexpected error fetching questions: {e}", None
260
 
 
365
  response = requests.post(submit_url, json=payload, timeout=60)
366
  response.raise_for_status()
367
  result_data = response.json()
368
+ except requests.exceptions.HTTPError as e:
369
  error_detail = f"HTTP Error: {e}"
370
  try:
371
  error_json = response.json()
 
397
 
398
 
399
 
400
+ except requests.exceptions.RequestException as e:
401
  print(f"Error submitting answers: {e}")
402
  return f"Error submitting answers: {e}", pd.DataFrame(results_log)
403
+ except requests.exceptions.JSONDecodeError as e:
404
  print(f"Error decoding JSON response of submission: {e}")
405
  return f"Error decoding JSON response of submission: {e}", pd.DataFrame(results_log)
406
+ except Exception as e:
407
  print(f"Unexpected error submitting answers: {e}")
408
  return f"Unexpected error submitting answers: {e}", pd.DataFrame(results_log)
409
 
 
417
  )
418
  print(status_message)
419
  return status_message, pd.DataFrame(results_log)
420
+ except Exception as e:
421
  print(f"Error formatting submission results: {e}")
422
  return f"Submission worked but formatting failed: {e}\nRaw data: {result_data}", pd.DataFrame(results_log)
423