Spaces:
Sleeping
Sleeping
| # main.py | |
| import requests | |
| from agent import run_agent | |
| USERNAME = "sminichiello" | |
| SPACE_URL = "https://huggingface.co/spaces/sminichiello/my-agent-demo" | |
| def get_question(): | |
| response = requests.get("https://gaia-benchmark.com/api/random-question") | |
| return response.json() | |
| def submit_answer(task_id, answer): | |
| payload = { | |
| "username": USERNAME, | |
| "agent_code": SPACE_URL, | |
| "answers": [ | |
| { | |
| "task_id": task_id, | |
| "submitted_answer": answer | |
| } | |
| ] | |
| } | |
| res = requests.post("https://gaia-benchmark.com/api/submit", json=payload) | |
| return res.json() | |
| # 1. Ottieni domanda | |
| q = get_question() | |
| print("β Domanda:", q["question"]) | |
| # 2. Rispondi con l'agente | |
| response = run_agent(q["question"]) | |
| print("π§ Risposta:", response) | |
| # 3. Invia a GAIA | |
| result = submit_answer(q["task_id"], response) | |
| print("β Risultato GAIA:", result) | |