Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- README.md +28 -0
- evaluate.py +38 -0
- requirements.txt +3 -0
README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
---
|
| 3 |
+
title: Gaia Agent
|
| 4 |
+
emoji: 馃實
|
| 5 |
+
colorFrom: green
|
| 6 |
+
colorTo: blue
|
| 7 |
+
sdk: gradio
|
| 8 |
+
sdk_version: "4.20.0"
|
| 9 |
+
app_file: app.py
|
| 10 |
+
pinned: false
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Agente GAIA para Hugging Face Spaces
|
| 14 |
+
|
| 15 |
+
Este proyecto contiene:
|
| 16 |
+
- Un agente simple listo para subir a un Space de Hugging Face.
|
| 17 |
+
- Un script Python (`evaluate.py`) para interactuar con el API de evaluaci贸n de GAIA.
|
| 18 |
+
|
| 19 |
+
## Requisitos
|
| 20 |
+
- Python 3.8+
|
| 21 |
+
- Clave de API de OpenAI (si usas un modelo real)
|
| 22 |
+
- Tener un Space p煤blico en Hugging Face
|
| 23 |
+
|
| 24 |
+
## C贸mo probar
|
| 25 |
+
1. Sube el contenido de esta carpeta a tu Hugging Face Space.
|
| 26 |
+
2. Ejecuta el Space y prueba manualmente.
|
| 27 |
+
3. Ajusta el script `evaluate.py` con los datos reales (API URL, tu Space, etc.).
|
| 28 |
+
4. Ejecuta el script para obtener las preguntas y enviar tus respuestas.
|
evaluate.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
# CONFIGURA TUS DATOS AQU脥
|
| 5 |
+
API_URL = "https://<API_DE_EVALUACION>/questions"
|
| 6 |
+
SUBMIT_URL = "https://<API_DE_EVALUACION>/submit"
|
| 7 |
+
SPACE_URL = "https://huggingface.co/spaces/<TU_USUARIO>/<NOMBRE_DEL_SPACE>/tree/main"
|
| 8 |
+
USERNAME = "<TU_USUARIO>"
|
| 9 |
+
|
| 10 |
+
# Obtener las preguntas
|
| 11 |
+
response = requests.get(API_URL)
|
| 12 |
+
questions = response.json()
|
| 13 |
+
|
| 14 |
+
answers = []
|
| 15 |
+
|
| 16 |
+
for q in questions:
|
| 17 |
+
task_id = q["task_id"]
|
| 18 |
+
task_data = q["question"]
|
| 19 |
+
|
| 20 |
+
# Llamada al agente
|
| 21 |
+
agent_response = requests.post(
|
| 22 |
+
"<URL_DEL_SPACE>/predict",
|
| 23 |
+
json={"task_id": task_id, "task_data": task_data}
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
+
submitted_answer = agent_response.json()["submitted_answer"]
|
| 27 |
+
|
| 28 |
+
answers.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 29 |
+
|
| 30 |
+
# Enviar respuestas
|
| 31 |
+
payload = {
|
| 32 |
+
"username": USERNAME,
|
| 33 |
+
"agent_code": SPACE_URL,
|
| 34 |
+
"answers": answers
|
| 35 |
+
}
|
| 36 |
+
|
| 37 |
+
submit_response = requests.post(SUBMIT_URL, json=payload)
|
| 38 |
+
print(submit_response.json())
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
gradio
|
| 3 |
+
requests
|