Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
-
from smolagents import CodeAgent,
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
@@ -56,6 +57,7 @@ def find_hotels(location: str, price_range: str) -> list:
|
|
56 |
return [{"error": f"Failed to fetch hotels: {str(e)}"}]
|
57 |
|
58 |
final_answer = FinalAnswerTool()
|
|
|
59 |
|
60 |
|
61 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
@@ -77,7 +79,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
77 |
|
78 |
agent = CodeAgent(
|
79 |
model=model,
|
80 |
-
tools=[final_answer,
|
81 |
max_steps=6,
|
82 |
verbosity_level=1,
|
83 |
grammar=None,
|
|
|
1 |
+
from smolagents import CodeAgent, HfApiModel,load_tool,tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
+
from tools.web_search import DuckDuckGoSearchTool
|
8 |
|
9 |
from Gradio_UI import GradioUI
|
10 |
|
|
|
57 |
return [{"error": f"Failed to fetch hotels: {str(e)}"}]
|
58 |
|
59 |
final_answer = FinalAnswerTool()
|
60 |
+
web_search = DuckDuckGoSearchTool()
|
61 |
|
62 |
|
63 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
79 |
|
80 |
agent = CodeAgent(
|
81 |
model=model,
|
82 |
+
tools=[final_answer, web_search], ## add your tools here (don't remove final answer)
|
83 |
max_steps=6,
|
84 |
verbosity_level=1,
|
85 |
grammar=None,
|