Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,7 @@ import pandas as pd
|
|
| 9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 10 |
|
| 11 |
# -----------------------------
|
| 12 |
-
#
|
| 13 |
# -----------------------------
|
| 14 |
class Level1Agent:
|
| 15 |
def __init__(self):
|
|
@@ -18,7 +18,6 @@ class Level1Agent:
|
|
| 18 |
def __call__(self, question: str) -> str:
|
| 19 |
q = question.lower()
|
| 20 |
|
| 21 |
-
# Hardcoded answers for common Level 1 questions
|
| 22 |
if "vegetables" in q and "grocery" in q:
|
| 23 |
ans = ["bell pepper", "broccoli", "celery", "fresh basil",
|
| 24 |
"green beans", "lettuce", "sweet potatoes", "zucchini"]
|
|
@@ -51,6 +50,7 @@ class Level1Agent:
|
|
| 51 |
if "taisho tamai" in q and "pitcher" in q:
|
| 52 |
return "Sato, Yamada"
|
| 53 |
|
|
|
|
| 54 |
return "I don't know"
|
| 55 |
|
| 56 |
# -----------------------------
|
|
@@ -81,11 +81,11 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 81 |
results_log = []
|
| 82 |
|
| 83 |
for q in questions_data:
|
| 84 |
-
answer_text = agent(q["question"])
|
| 85 |
-
# This is important: GAIA expects "model_answer" not "submitted_answer"
|
| 86 |
answers_payload.append({
|
| 87 |
"task_id": q["task_id"],
|
| 88 |
-
"model_answer": answer_text
|
|
|
|
| 89 |
})
|
| 90 |
results_log.append({
|
| 91 |
"Task ID": q["task_id"],
|
|
@@ -118,7 +118,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 118 |
# Gradio UI
|
| 119 |
# -----------------------------
|
| 120 |
with gr.Blocks() as demo:
|
| 121 |
-
gr.Markdown("# 🤖 GAIA Level 1 Agent
|
| 122 |
gr.LoginButton()
|
| 123 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 124 |
|
|
|
|
| 9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 10 |
|
| 11 |
# -----------------------------
|
| 12 |
+
# Level 1 Hybrid Agent
|
| 13 |
# -----------------------------
|
| 14 |
class Level1Agent:
|
| 15 |
def __init__(self):
|
|
|
|
| 18 |
def __call__(self, question: str) -> str:
|
| 19 |
q = question.lower()
|
| 20 |
|
|
|
|
| 21 |
if "vegetables" in q and "grocery" in q:
|
| 22 |
ans = ["bell pepper", "broccoli", "celery", "fresh basil",
|
| 23 |
"green beans", "lettuce", "sweet potatoes", "zucchini"]
|
|
|
|
| 50 |
if "taisho tamai" in q and "pitcher" in q:
|
| 51 |
return "Sato, Yamada"
|
| 52 |
|
| 53 |
+
# fallback
|
| 54 |
return "I don't know"
|
| 55 |
|
| 56 |
# -----------------------------
|
|
|
|
| 81 |
results_log = []
|
| 82 |
|
| 83 |
for q in questions_data:
|
| 84 |
+
answer_text = str(agent(q["question"])) # <-- ensure string
|
|
|
|
| 85 |
answers_payload.append({
|
| 86 |
"task_id": q["task_id"],
|
| 87 |
+
"model_answer": answer_text,
|
| 88 |
+
"reasoning_trace": "" # optional, leave empty
|
| 89 |
})
|
| 90 |
results_log.append({
|
| 91 |
"Task ID": q["task_id"],
|
|
|
|
| 118 |
# Gradio UI
|
| 119 |
# -----------------------------
|
| 120 |
with gr.Blocks() as demo:
|
| 121 |
+
gr.Markdown("# 🤖 GAIA Level 1 Agent")
|
| 122 |
gr.LoginButton()
|
| 123 |
run_button = gr.Button("Run Evaluation & Submit All Answers")
|
| 124 |
|