Spaces:
Sleeping
Sleeping
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:123456789101112131415161718192021222324252627282930313233from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,toolfrom datetime import datetime,timedeltaimport requestsimport pytzimport yamlfrom tools.final_answer import FinalAnswerToolimport yfinance as yffrom Gradio_UI import GradioUI# Below is an example of a tool that does nothing. Amaze us with your creativity !@tooldef my_custom_tool(symbol: str)-> 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 returns todays data for symbolArgs:symbol:for which symbol the data is to be fetched"""start_date = (datetime.now() - timedelta(days=1)).strftime("%Y-%m-%d")end_date = datetime.now().strftime("%Y-%m-%d")ticker = yf.Ticker(symbol)df = ticker.history(start=start_date, end=end_date, auto_adjust=True)return f"""Today's Stock data for {symbol}:Open : {df['Open'].iloc[0]}High : {df['High'].iloc[0]}Low : {df['Low'].iloc[0]}Close : {df['Open'].iloc[0]}Volume : {df['Volume'].iloc[0]}"""@tooldef get_current_time_in_timezone(timezone: str) -> str:
app.py+17-6