Spaces:
Sleeping
Sleeping
updated app.py
Browse files112342 unmodified lines789101011121314152 unmodified lines1819201921222322242526252728293031from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,toolfrom smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, load_tool, toolimport datetimeimport requestsimport pytz2 unmodified lines
from Gradio_UI import GradioUI
# Below is an example of a tool that does nothing. Amaze us with your creativity !# 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 lines query: The search query string to look up on DuckDuckGo. Returns: str: The search results from DuckDuckGo. str: The search results from DuckDuckGo in markdown format. Example: search("What is Python programming language?") search("What is the capital of France?") """ try: results = DuckDuckGoSearchTool(query) # Use the DuckDuckGoSearchTool instance to perform the search results = search_tool.forward(query) return results except Exception as e: return f"Error performing search: {str(e)}"app.py+8-5