Spaces:
Sleeping
Sleeping
Create submit.py
Browse files
submit.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import requests
|
| 2 |
+
from agent import answer_question
|
| 3 |
+
|
| 4 |
+
# Get GAIA questions
|
| 5 |
+
questions = requests.get("https://api.gaia-course.com/questions").json()
|
| 6 |
+
|
| 7 |
+
# Format answers
|
| 8 |
+
answers = []
|
| 9 |
+
for q in questions:
|
| 10 |
+
task_id = q["task_id"]
|
| 11 |
+
question = q["question"]
|
| 12 |
+
response = answer_question(question)
|
| 13 |
+
answers.append({"task_id": task_id, "submitted_answer": response.strip()})
|
| 14 |
+
|
| 15 |
+
# Submit answers
|
| 16 |
+
submission = {
|
| 17 |
+
"username": "your-hf-username",
|
| 18 |
+
"agent_code": "https://huggingface.co/spaces/yourname/your-space/tree/main",
|
| 19 |
+
"answers": answers
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
+
submit_response = requests.post("https://api.gaia-course.com/submit", json=submission)
|
| 23 |
+
print(submit_response.json())
|