Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,9 @@ from smolagents import CodeAgent, HfApiModel,load_tool, tool, Tool
|
|
| 3 |
from smolagents import GoogleSearchTool, PythonInterpreterTool
|
| 4 |
# from smolagents.models import InferenceAPIModel #InferenceClientModel
|
| 5 |
|
|
|
|
|
|
|
|
|
|
| 6 |
import requests
|
| 7 |
import pytz
|
| 8 |
import yaml
|
|
@@ -114,7 +117,7 @@ image_generation_tool2 = Tool.from_space(
|
|
| 114 |
final_answer = FinalAnswerTool()
|
| 115 |
web_search = DuckDuckGoSearchTool()
|
| 116 |
visit_webpage = VisitWebpageTool()
|
| 117 |
-
|
| 118 |
python_tool = PythonInterpreterTool()
|
| 119 |
|
| 120 |
# 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:
|
|
@@ -134,7 +137,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 134 |
|
| 135 |
agent = CodeAgent(
|
| 136 |
model=model,
|
| 137 |
-
tools=[final_answer, my_custom_tool, get_current_time_in_timezone, web_search, visit_webpage,
|
| 138 |
python_tool, image_generation_tool, image_generation_tool2,
|
| 139 |
suggest_menu, catering_service_tool, SuperheroPartyThemeTool()], ## add your tools here (don't remove final answer)
|
| 140 |
max_steps=10,
|
|
|
|
| 3 |
from smolagents import GoogleSearchTool, PythonInterpreterTool
|
| 4 |
# from smolagents.models import InferenceAPIModel #InferenceClientModel
|
| 5 |
|
| 6 |
+
# Set your API key for GoogleSearchTool
|
| 7 |
+
os.environ["SERPAPI_API_KEY"] = "85eb0488406ce82984e0ca0a70e30eb5287affd90f22c3a87478b3f6f1b0847c"
|
| 8 |
+
|
| 9 |
import requests
|
| 10 |
import pytz
|
| 11 |
import yaml
|
|
|
|
| 117 |
final_answer = FinalAnswerTool()
|
| 118 |
web_search = DuckDuckGoSearchTool()
|
| 119 |
visit_webpage = VisitWebpageTool()
|
| 120 |
+
google_search_tool = GoogleSearchTool()
|
| 121 |
python_tool = PythonInterpreterTool()
|
| 122 |
|
| 123 |
# 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:
|
|
|
|
| 137 |
|
| 138 |
agent = CodeAgent(
|
| 139 |
model=model,
|
| 140 |
+
tools=[final_answer, my_custom_tool, get_current_time_in_timezone, web_search, visit_webpage, google_search_tool,
|
| 141 |
python_tool, image_generation_tool, image_generation_tool2,
|
| 142 |
suggest_menu, catering_service_tool, SuperheroPartyThemeTool()], ## add your tools here (don't remove final answer)
|
| 143 |
max_steps=10,
|