Spaces:
Sleeping
Sleeping
Delete api.py
Browse files
api.py
DELETED
|
@@ -1,32 +0,0 @@
|
|
| 1 |
-
import requests
|
| 2 |
-
|
| 3 |
-
API_BASE = "https://huggingface.co/datasets/gaia-benchmark/GAIA/blob/main/2023/validation/metadata.jsonl"
|
| 4 |
-
|
| 5 |
-
def get_all_questions():
|
| 6 |
-
print(f"[INFO] Fetching: {API_BASE}/questions")
|
| 7 |
-
response = requests.get(f"{API_BASE}/questions")
|
| 8 |
-
|
| 9 |
-
print("[DEBUG] Status Code:", response.status_code)
|
| 10 |
-
print("[DEBUG] Raw Response:", response.text[:500]) # limit to 500 chars
|
| 11 |
-
|
| 12 |
-
response.raise_for_status() # raise if 4xx/5xx
|
| 13 |
-
|
| 14 |
-
return response.json()
|
| 15 |
-
|
| 16 |
-
def get_random_question():
|
| 17 |
-
return requests.get(f"{API_BASE}/random-question").json()
|
| 18 |
-
|
| 19 |
-
def get_file(task_id, filename):
|
| 20 |
-
url = f"{API_BASE}/files/{task_id}/{filename}"
|
| 21 |
-
r = requests.get(url)
|
| 22 |
-
r.raise_for_status()
|
| 23 |
-
return r.content
|
| 24 |
-
|
| 25 |
-
def submit_answers(username, code_link, answers):
|
| 26 |
-
payload = {
|
| 27 |
-
"username": username,
|
| 28 |
-
"agent_code": code_link,
|
| 29 |
-
"answers": answers
|
| 30 |
-
}
|
| 31 |
-
r = requests.post(f"{API_BASE}/submit", json=payload)
|
| 32 |
-
return r.json()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|