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