Spaces:
Sleeping
Sleeping
File size: 956 Bytes
d928c3d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# 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)
|