Spaces:
Sleeping
Sleeping
| import requests | |
| # CONFIGURA TUS DATOS AQUÍ | |
| API_URL = "https://<API_DE_EVALUACION>/questions" | |
| SUBMIT_URL = "https://<API_DE_EVALUACION>/submit" | |
| SPACE_URL = "https://huggingface.co/spaces/<TU_USUARIO>/<NOMBRE_DEL_SPACE>/tree/main" | |
| USERNAME = "<TU_USUARIO>" | |
| # Obtener las preguntas | |
| response = requests.get(API_URL) | |
| questions = response.json() | |
| answers = [] | |
| for q in questions: | |
| task_id = q["task_id"] | |
| task_data = q["question"] | |
| # Llamada al agente | |
| agent_response = requests.post( | |
| "<URL_DEL_SPACE>/predict", | |
| json={"task_id": task_id, "task_data": task_data} | |
| ) | |
| submitted_answer = agent_response.json()["submitted_answer"] | |
| answers.append({"task_id": task_id, "submitted_answer": submitted_answer}) | |
| # Enviar respuestas | |
| payload = { | |
| "username": USERNAME, | |
| "agent_code": SPACE_URL, | |
| "answers": answers | |
| } | |
| submit_response = requests.post(SUBMIT_URL, json=payload) | |
| print(submit_response.json()) | |