Update app.py
Browse files12345678910111213141516171819202122from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,toolimport datetimeimport requestsimport 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_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type#Keep this format for the description / args / args description but feel free to modify the tool"""A tool that does nothing yetArgs:arg1: the first argumentarg2: the second argument"""return "What magic will you build ?"@tooldef get_current_time_in_timezone(timezone: str) -> str:12345678910111213141516171819202122from smolagents import CodeAgent, DuckDuckGoSearchTool, VisitWebpageTool, HfApiModel, load_toolmodel = HfApiModel(max_tokens=2096, temperature=0.5,model_id='Qwen/Qwen2.5-Coder-32B-Instruct')image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)agent = CodeAgent(model=model,tools=[final_answer,DuckDuckGoSearchTool(), # <-- actually add search nowVisitWebpageTool(), # <-- read pages the search findsimage_generation_tool, # <-- you defined this but never added it either!my_weather_tool, # your own custom tool],max_steps=6,verbosity_level=1,)@tooldef get_current_time_in_timezone(timezone: str) -> str:
app.py+17-17