Update app.py
Browse filesf918266a-b3e0-4914-865d-4faa564f1aef
app.py
CHANGED
|
@@ -265,9 +265,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 265 |
if item.get("file_name"):
|
| 266 |
# question_text = f"{question_text} Here is the file: https://agents-course-unit4-scoring.hf.space/files/{item.get('task_id')}"
|
| 267 |
question_text = f"{question_text} Here is the file (the file extension must be added): files/{item.get('task_id')}"
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
|
|
|
|
|
|
| 271 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 272 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 273 |
# Sleep to avoid the Gemini throttling at 15 RPM
|
|
@@ -280,7 +282,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 280 |
print("Agent did not produce any answers to submit.")
|
| 281 |
return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
| 282 |
|
| 283 |
-
|
| 284 |
|
| 285 |
# 4. Prepare Submission
|
| 286 |
submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
|
|
|
|
| 265 |
if item.get("file_name"):
|
| 266 |
# question_text = f"{question_text} Here is the file: https://agents-course-unit4-scoring.hf.space/files/{item.get('task_id')}"
|
| 267 |
question_text = f"{question_text} Here is the file (the file extension must be added): files/{item.get('task_id')}"
|
| 268 |
+
|
| 269 |
+
if item.get("task_id") == "f918266a-b3e0-4914-865d-4faa564f1aef":
|
| 270 |
+
submitted_answer = agent(question_text)
|
| 271 |
+
else:
|
| 272 |
+
continue
|
| 273 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 274 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 275 |
# Sleep to avoid the Gemini throttling at 15 RPM
|
|
|
|
| 282 |
print("Agent did not produce any answers to submit.")
|
| 283 |
return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
| 284 |
|
| 285 |
+
return "Questions parsed.", pd.DataFrame(results_log)
|
| 286 |
|
| 287 |
# 4. Prepare Submission
|
| 288 |
submission_data = {"username": username.strip(), "agent_code": agent_code, "answers": answers_payload}
|