Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,19 +28,15 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
| 28 |
# return fixed_answer
|
| 29 |
|
| 30 |
|
| 31 |
-
def
|
| 32 |
try:
|
| 33 |
-
# Authenticate with HF token
|
| 34 |
token = os.getenv("HF_TOKEN")
|
| 35 |
if not token:
|
| 36 |
-
return "β HF_TOKEN not found.
|
| 37 |
|
| 38 |
login(token)
|
| 39 |
-
|
| 40 |
-
# Load GAIA Level 1 validation set
|
| 41 |
dataset = load_dataset("gaia-benchmark/GAIA", "2023_level1", split="validation", trust_remote_code=True)
|
| 42 |
|
| 43 |
-
# Save to CSV
|
| 44 |
output_path = "gaia_level1_validation.csv"
|
| 45 |
keys = dataset[0].keys()
|
| 46 |
|
|
@@ -50,9 +46,9 @@ def download_gaia_to_csv():
|
|
| 50 |
for row in dataset:
|
| 51 |
writer.writerow(row)
|
| 52 |
|
| 53 |
-
return f"β
|
| 54 |
except Exception as e:
|
| 55 |
-
return f"β Error: {e}"
|
| 56 |
|
| 57 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 58 |
"""
|
|
@@ -198,6 +194,8 @@ with gr.Blocks() as demo:
|
|
| 198 |
test_eval_button = gr.Button("π Evaluate on Local GAIA Test Set")
|
| 199 |
|
| 200 |
download_db_button = gr.Button("=== Download DB ====")
|
|
|
|
|
|
|
| 201 |
|
| 202 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 203 |
|
|
@@ -215,9 +213,9 @@ with gr.Blocks() as demo:
|
|
| 215 |
outputs=[status_output, results_table]
|
| 216 |
)
|
| 217 |
|
| 218 |
-
|
| 219 |
-
fn=
|
| 220 |
-
outputs=[status_output]
|
| 221 |
)
|
| 222 |
|
| 223 |
|
|
|
|
| 28 |
# return fixed_answer
|
| 29 |
|
| 30 |
|
| 31 |
+
def download_gaia_to_csv_and_return_path():
|
| 32 |
try:
|
|
|
|
| 33 |
token = os.getenv("HF_TOKEN")
|
| 34 |
if not token:
|
| 35 |
+
return None, "β HF_TOKEN not found."
|
| 36 |
|
| 37 |
login(token)
|
|
|
|
|
|
|
| 38 |
dataset = load_dataset("gaia-benchmark/GAIA", "2023_level1", split="validation", trust_remote_code=True)
|
| 39 |
|
|
|
|
| 40 |
output_path = "gaia_level1_validation.csv"
|
| 41 |
keys = dataset[0].keys()
|
| 42 |
|
|
|
|
| 46 |
for row in dataset:
|
| 47 |
writer.writerow(row)
|
| 48 |
|
| 49 |
+
return output_path, f"β
File saved: {output_path} β ready for download."
|
| 50 |
except Exception as e:
|
| 51 |
+
return None, f"β Error: {e}"
|
| 52 |
|
| 53 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 54 |
"""
|
|
|
|
| 194 |
test_eval_button = gr.Button("π Evaluate on Local GAIA Test Set")
|
| 195 |
|
| 196 |
download_db_button = gr.Button("=== Download DB ====")
|
| 197 |
+
file_output = gr.File(label="Download CSV")
|
| 198 |
+
status_output = gr.Textbox(label="Status")
|
| 199 |
|
| 200 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 201 |
|
|
|
|
| 213 |
outputs=[status_output, results_table]
|
| 214 |
)
|
| 215 |
|
| 216 |
+
download_button.click(
|
| 217 |
+
fn=download_gaia_to_csv_and_return_path,
|
| 218 |
+
outputs=[file_output, status_output]
|
| 219 |
)
|
| 220 |
|
| 221 |
|