Update app.py
Browse files
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
|
275 |
answers.append({
|
276 |
"task_id": task_id,
|
277 |
-
"
|
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
|
290 |
-
# The server expects
|
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
|