Spaces:
Sleeping
Sleeping
Update app.py
Browse files3 unmodified lines4567891011123 unmodified lines161718192021223 unmodified linesimport pytzimport yamlfrom tools.final_answer import FinalAnswerToolfrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type3 unmodified linesarg1: the first argumentarg2: the second argument"""return "What magic will you build ?"@tooldef get_current_time_in_timezone(timezone: str) -> str:3 unmodified lines456789101112131415161718192021222324253 unmodified lines2930313233343536373839403 unmodified linesimport pytzimport yamlfrom tools.final_answer import FinalAnswerToolfrom ducduckgo_search import DDGSfrom Gradio_UI import GradioUI@tooldef search_duckduckgo(query: str) -> str:"""Searches DuckDuckGo for the given query.Args:query: The search query."""ddgs = DDGS()results = []for r in ddgs.text(query, max_results=5): #limit to 5 results for brevity in responseresults.append(f"Title: {r['title']}\nURL: {r['href']}\nSnippet: {r['snippet']}")return "\n\n".join(results) or "No results found."# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type3 unmodified linesarg1: the first argumentarg2: the second argument"""try:num1 = float(arg1)result = num1 * arg2return f"The result of {arg1} multiplied by {arg2} is: {result}"except ValueError:return "Invalid input: arg1 must be a number."@tooldef get_current_time_in_timezone(timezone: str) -> str:
app.py+19-1