Update app.py
Browse files
app.py
CHANGED
|
@@ -119,7 +119,7 @@ def python_calculator(expression: str) -> str:
|
|
| 119 |
|
| 120 |
|
| 121 |
# βββββββββββββββββββββββββββββββββββββββββββββ
|
| 122 |
-
# AGENT
|
| 123 |
# βββββββββββββββββββββββββββββββββββββββββββββ
|
| 124 |
|
| 125 |
INSTRUCTIONS = """You are a precise research assistant solving GAIA benchmark tasks.
|
|
@@ -139,10 +139,9 @@ APPROACH:
|
|
| 139 |
4. Return the bare answer and nothing else.
|
| 140 |
"""
|
| 141 |
|
| 142 |
-
#
|
| 143 |
-
# HF Spaces injects HF_TOKEN automatically β pass it so inference works
|
| 144 |
model = InferenceClientModel(
|
| 145 |
-
model_id="Qwen/Qwen2.5-
|
| 146 |
token=os.environ.get("HF_TOKEN"),
|
| 147 |
)
|
| 148 |
|
|
@@ -155,7 +154,7 @@ agent = ToolCallingAgent(
|
|
| 155 |
read_local_file,
|
| 156 |
python_calculator,
|
| 157 |
],
|
| 158 |
-
max_steps=
|
| 159 |
verbosity_level=1,
|
| 160 |
instructions=INSTRUCTIONS,
|
| 161 |
)
|
|
@@ -288,10 +287,10 @@ def evaluate(hf_username: str, code_url: str, progress=ui.Progress()):
|
|
| 288 |
if resp.status_code == 200:
|
| 289 |
data = resp.json()
|
| 290 |
score = data.get("score", 0)
|
| 291 |
-
correct = round(score * total)
|
| 292 |
return (
|
| 293 |
f"### π Done!\n\n"
|
| 294 |
-
f"**Score:** {score*100:.1f}% ({correct}/{total})\n\n"
|
| 295 |
f"**Server:** {data.get('message', '')}"
|
| 296 |
)
|
| 297 |
return f"β HTTP {resp.status_code}: {resp.text}"
|
|
@@ -304,7 +303,7 @@ def evaluate(hf_username: str, code_url: str, progress=ui.Progress()):
|
|
| 304 |
# UI
|
| 305 |
# βββββββββββββββββββββββββββββββββββββββββββββ
|
| 306 |
|
| 307 |
-
with ui.Blocks() as interface:
|
| 308 |
ui.Markdown("# π GAIA Benchmark Agent β Unit 4")
|
| 309 |
ui.Markdown("Runs 20 Level-1 GAIA tasks using web search, Wikipedia, file reading, and a calculator.")
|
| 310 |
with ui.Row():
|
|
|
|
| 119 |
|
| 120 |
|
| 121 |
# βββββββββββββββββββββββββββββββββββββββββββββ
|
| 122 |
+
# AGENT SETUP
|
| 123 |
# βββββββββββββββββββββββββββββββββββββββββββββ
|
| 124 |
|
| 125 |
INSTRUCTIONS = """You are a precise research assistant solving GAIA benchmark tasks.
|
|
|
|
| 139 |
4. Return the bare answer and nothing else.
|
| 140 |
"""
|
| 141 |
|
| 142 |
+
# Swapped to standard coder tier to avoid '402 Payment Required' credit limits
|
|
|
|
| 143 |
model = InferenceClientModel(
|
| 144 |
+
model_id="Qwen/Qwen2.5-Coder-32B-Instruct",
|
| 145 |
token=os.environ.get("HF_TOKEN"),
|
| 146 |
)
|
| 147 |
|
|
|
|
| 154 |
read_local_file,
|
| 155 |
python_calculator,
|
| 156 |
],
|
| 157 |
+
max_steps=8,
|
| 158 |
verbosity_level=1,
|
| 159 |
instructions=INSTRUCTIONS,
|
| 160 |
)
|
|
|
|
| 287 |
if resp.status_code == 200:
|
| 288 |
data = resp.json()
|
| 289 |
score = data.get("score", 0)
|
| 290 |
+
correct = int(round(score * total)) # Fixed double scaling representation error
|
| 291 |
return (
|
| 292 |
f"### π Done!\n\n"
|
| 293 |
+
f"**Score:** {score*100:.1f}% ({correct}/{total} Correct)\n\n"
|
| 294 |
f"**Server:** {data.get('message', '')}"
|
| 295 |
)
|
| 296 |
return f"β HTTP {resp.status_code}: {resp.text}"
|
|
|
|
| 303 |
# UI
|
| 304 |
# βββββββββββββββββββββββββββββββββββββββββββββ
|
| 305 |
|
| 306 |
+
with ui.Blocks(theme=ui.themes.Soft()) as interface:
|
| 307 |
ui.Markdown("# π GAIA Benchmark Agent β Unit 4")
|
| 308 |
ui.Markdown("Runs 20 Level-1 GAIA tasks using web search, Wikipedia, file reading, and a calculator.")
|
| 309 |
with ui.Row():
|