Spaces:
Sleeping
Sleeping
Update run.py
Browse files
run.py
CHANGED
|
@@ -1,10 +1,29 @@
|
|
| 1 |
from questions import get_all_questions
|
| 2 |
-
from gaia_interface import submit_to_leaderboard
|
| 3 |
|
| 4 |
def run_and_submit_all(agent):
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
answers = []
|
| 7 |
-
for q in questions:
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
answers.append({"question_id": q["id"], "answer": answer})
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from questions import get_all_questions
|
| 2 |
+
from gaia_interface import submit_to_leaderboard
|
| 3 |
|
| 4 |
def run_and_submit_all(agent):
|
| 5 |
+
print("✅ [Checkpoint 1] Loading questions...")
|
| 6 |
+
try:
|
| 7 |
+
questions = get_all_questions()
|
| 8 |
+
except Exception as e:
|
| 9 |
+
return f"❌ Failed to load questions: {e}"
|
| 10 |
+
|
| 11 |
+
print(f"✅ [Checkpoint 2] Loaded {len(questions)} questions.")
|
| 12 |
+
|
| 13 |
answers = []
|
| 14 |
+
for i, q in enumerate(questions):
|
| 15 |
+
print(f"➡️ [Checkpoint 3.{i}] Processing question ID: {q.get('id', 'UNKNOWN')}")
|
| 16 |
+
try:
|
| 17 |
+
answer = agent.answer_question(q)
|
| 18 |
+
except Exception as e:
|
| 19 |
+
return f"❌ Failed while answering question {q.get('id', 'UNKNOWN')}: {e}"
|
| 20 |
answers.append({"question_id": q["id"], "answer": answer})
|
| 21 |
+
|
| 22 |
+
print("✅ [Checkpoint 4] All answers generated. Preparing submission...")
|
| 23 |
+
|
| 24 |
+
try:
|
| 25 |
+
result = submit_to_leaderboard(answers)
|
| 26 |
+
print("✅ [Checkpoint 5] Submission succeeded.")
|
| 27 |
+
return result
|
| 28 |
+
except Exception as e:
|
| 29 |
+
return f"❌ Submission failed: {e}"
|