mrpe24 commited on
Commit
3d35ea5
·
1 Parent(s): baa217f

fixed submit answers

Browse files
agentcourse_unit4/api/agent_eval_api.py CHANGED
@@ -38,7 +38,7 @@ class AgentEvalApi:
38
  request_body = {
39
  "username": username.strip(),
40
  "agent_code": agent_code,
41
- "answers": [{"task_id": a.task_id, "submitted_answer": a.answer} for a in answers]
42
  }
43
  response = requests.post(self.submit_url, json=request_body, timeout=60)
44
  response.raise_for_status()
 
38
  request_body = {
39
  "username": username.strip(),
40
  "agent_code": agent_code,
41
+ "answers": [{"task_id": a.task_id, "submitted_answer": str(a.answer)} for a in answers]
42
  }
43
  response = requests.post(self.submit_url, json=request_body, timeout=60)
44
  response.raise_for_status()
app.py CHANGED
@@ -72,10 +72,10 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
72
  try:
73
  file_path = api_client.download_file(task_id) if len(file_name) > 0 else None
74
  submitted_answer = agent.run(question_text, file_path)
75
- answers_payload.append(AnswerData(task_id=task_id, answer=submitted_answer))
76
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
77
 
78
- time.sleep(40) # to not exceed free limits
79
  except Exception as e:
80
  print(f"Error running agent on task {task_id}: {e}")
81
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
 
72
  try:
73
  file_path = api_client.download_file(task_id) if len(file_name) > 0 else None
74
  submitted_answer = agent.run(question_text, file_path)
75
+ answers_payload.append(AnswerData(task_id=task_id, answer=str(submitted_answer)))
76
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
77
 
78
+ time.sleep(50) # to not exceed free limits
79
  except Exception as e:
80
  print(f"Error running agent on task {task_id}: {e}")
81
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})