Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,20 +27,21 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 27 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|
| 28 |
# return fixed_answer
|
| 29 |
|
|
|
|
| 30 |
def download_gaia_to_csv():
|
| 31 |
try:
|
| 32 |
-
# Authenticate
|
| 33 |
token = os.getenv("HF_TOKEN")
|
| 34 |
if not token:
|
| 35 |
return "❌ HF_TOKEN not found. Please set it in your Space's secrets."
|
| 36 |
|
| 37 |
-
login(token)
|
| 38 |
|
| 39 |
-
# Load
|
| 40 |
-
dataset = load_dataset("gaia-benchmark/GAIA", split="dev", trust_remote_code=True)
|
| 41 |
|
| 42 |
# Save to CSV
|
| 43 |
-
output_path = "
|
| 44 |
keys = dataset[0].keys()
|
| 45 |
|
| 46 |
with open(output_path, "w", newline="", encoding="utf-8") as f:
|
|
@@ -49,7 +50,7 @@ def download_gaia_to_csv():
|
|
| 49 |
for row in dataset:
|
| 50 |
writer.writerow(row)
|
| 51 |
|
| 52 |
-
return f"✅ GAIA dev dataset saved
|
| 53 |
except Exception as e:
|
| 54 |
return f"❌ Error: {e}"
|
| 55 |
|
|
|
|
| 27 |
# print(f"Agent returning fixed answer: {fixed_answer}")
|
| 28 |
# return fixed_answer
|
| 29 |
|
| 30 |
+
|
| 31 |
def download_gaia_to_csv():
|
| 32 |
try:
|
| 33 |
+
# Authenticate with HF token
|
| 34 |
token = os.getenv("HF_TOKEN")
|
| 35 |
if not token:
|
| 36 |
return "❌ HF_TOKEN not found. Please set it in your Space's secrets."
|
| 37 |
|
| 38 |
+
login(token)
|
| 39 |
|
| 40 |
+
# Load only Level 1 questions from the dev set
|
| 41 |
+
dataset = load_dataset("gaia-benchmark/GAIA", "2023_level1", split="dev", trust_remote_code=True)
|
| 42 |
|
| 43 |
# Save to CSV
|
| 44 |
+
output_path = "gaia_dev_level1.csv"
|
| 45 |
keys = dataset[0].keys()
|
| 46 |
|
| 47 |
with open(output_path, "w", newline="", encoding="utf-8") as f:
|
|
|
|
| 50 |
for row in dataset:
|
| 51 |
writer.writerow(row)
|
| 52 |
|
| 53 |
+
return f"✅ GAIA Level 1 dev dataset saved to {output_path}"
|
| 54 |
except Exception as e:
|
| 55 |
return f"❌ Error: {e}"
|
| 56 |
|