Spaces:
Sleeping
Sleeping
updated app.py
Browse files12342 unmodified lines789101112132 unmodified lines16171819202122232425262728from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,toolimport datetimeimport requestsimport pytz2 unmodified linesfrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef search(query: str) -> str:"""A tool that performs web searches using DuckDuckGo.2 unmodified linesquery: The search query string to look up on DuckDuckGo.Returns:str: The search results from DuckDuckGo.Example:search("What is Python programming language?")"""try:results = DuckDuckGoSearchTool(query)return resultsexcept Exception as e:return f"Error performing search: {str(e)}"12342 unmodified lines7891011121314152 unmodified lines1819202122232425262728293031from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, toolimport datetimeimport requestsimport pytz2 unmodified linesfrom Gradio_UI import GradioUI# Create an instance of DuckDuckGoSearchToolsearch_tool = DuckDuckGoSearchTool(max_results=10)@tooldef search(query: str) -> str:"""A tool that performs web searches using DuckDuckGo.2 unmodified linesquery: The search query string to look up on DuckDuckGo.Returns:str: The search results from DuckDuckGo in markdown format.Example:search("What is the capital of France?")"""try:# Use the DuckDuckGoSearchTool instance to perform the searchresults = search_tool.forward(query)return resultsexcept Exception as e:return f"Error performing search: {str(e)}"
app.py+8-5