yoshizen commited on
Commit
2b8488d
·
verified ·
1 Parent(s): 3ceac48

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -271,10 +271,10 @@ def run_agent_on_questions(agent, questions):
271
  # Get answer from agent
272
  answer = agent.answer(question_text)
273
 
274
- # Add to answers list with the correct format
275
  answers.append({
276
  "task_id": task_id,
277
- "answer": answer # Changed from "submitted_answer" to "answer"
278
  })
279
 
280
  logger.info(f"Task {task_id}: '{question_text[:50]}...' -> '{answer}'")
@@ -286,8 +286,8 @@ def submit_answers(answers, username, api_url=DEFAULT_API_URL):
286
  logger.info(f"Submitting {len(answers)} answers for user '{username}'...")
287
 
288
  try:
289
- # FIXED: Format the payload correctly according to API expectations
290
- # The server expects a specific format with agent_code and answers
291
  payload = {
292
  "agent_code": f"https://huggingface.co/spaces/{username}/Final_Assignment_Template/blob/main/app.py",
293
  "answers": answers
 
271
  # Get answer from agent
272
  answer = agent.answer(question_text)
273
 
274
+ # Add to answers list with the CORRECT field name as per documentation
275
  answers.append({
276
  "task_id": task_id,
277
+ "submitted_answer": answer # FIXED: Using "submitted_answer" as specified in the documentation
278
  })
279
 
280
  logger.info(f"Task {task_id}: '{question_text[:50]}...' -> '{answer}'")
 
286
  logger.info(f"Submitting {len(answers)} answers for user '{username}'...")
287
 
288
  try:
289
+ # FIXED: Format the payload correctly according to API documentation
290
+ # The server expects agent_code and answers with submitted_answer field
291
  payload = {
292
  "agent_code": f"https://huggingface.co/spaces/{username}/Final_Assignment_Template/blob/main/app.py",
293
  "answers": answers