Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,18 +4,26 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# (Keep Constants as is)
|
| 8 |
# --- Constants ---
|
| 9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 10 |
|
| 11 |
-
|
| 12 |
-
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 13 |
-
class BasicAgent:
|
| 14 |
def __init__(self):
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
def __call__(self, question: str) -> str:
|
| 17 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 18 |
-
|
| 19 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 20 |
return fixed_answer
|
| 21 |
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
|
| 7 |
+
from smolagents import (
|
| 8 |
+
InferenceClientModel,
|
| 9 |
+
CodeAgent
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
# (Keep Constants as is)
|
| 13 |
# --- Constants ---
|
| 14 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 15 |
|
| 16 |
+
class BestAgent:
|
|
|
|
|
|
|
| 17 |
def __init__(self):
|
| 18 |
+
model_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
|
| 19 |
+
model = InferenceClientModel(model_id)
|
| 20 |
+
self.agent = CodeAgent(
|
| 21 |
+
model=model
|
| 22 |
+
tools=[]
|
| 23 |
+
)
|
| 24 |
def __call__(self, question: str) -> str:
|
| 25 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 26 |
+
answer = self.agent.run(question)
|
| 27 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 28 |
return fixed_answer
|
| 29 |
|