Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import gradio as gr
|
|
| 3 |
import requests
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool
|
| 7 |
|
| 8 |
# (Keep Constants as is)
|
| 9 |
# --- Constants ---
|
|
@@ -15,14 +15,17 @@ class BasicAgent:
|
|
| 15 |
def __init__(self):
|
| 16 |
print("Initializing Smolagents-based BasicAgent...")
|
| 17 |
|
| 18 |
-
hf_token = os.getenv("HF_TOKEN")
|
| 19 |
-
|
| 20 |
# Create the tools the agent can use
|
| 21 |
self.search_tool = DuckDuckGoSearchTool()
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Create a reasoning agent that can call tools
|
| 24 |
self.agent = CodeAgent(
|
| 25 |
-
model=
|
| 26 |
tools=[self.search_tool],
|
| 27 |
max_steps=6,
|
| 28 |
)
|
|
|
|
| 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 ---
|
|
|
|
| 15 |
def __init__(self):
|
| 16 |
print("Initializing Smolagents-based BasicAgent...")
|
| 17 |
|
|
|
|
|
|
|
| 18 |
# Create the tools the agent can use
|
| 19 |
self.search_tool = DuckDuckGoSearchTool()
|
| 20 |
|
| 21 |
+
self.model = HfApiModel(
|
| 22 |
+
model_id= "google/gemma-2b-it",
|
| 23 |
+
token=os.getenv("HF_TOKEN")
|
| 24 |
+
)
|
| 25 |
+
|
| 26 |
# Create a reasoning agent that can call tools
|
| 27 |
self.agent = CodeAgent(
|
| 28 |
+
model=self.model,
|
| 29 |
tools=[self.search_tool],
|
| 30 |
max_steps=6,
|
| 31 |
)
|