Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,9 +4,14 @@ import requests
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
|
|
|
|
|
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
|
|
|
|
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
@@ -32,6 +37,18 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 32 |
return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
import finnhub
|
| 8 |
+
|
| 9 |
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
| 12 |
+
apikey = "cus67l1r01qt2ncila50cus67l1r01qt2ncila5g"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 16 |
@tool
|
| 17 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 37 |
return f"The current local time in {timezone} is: {local_time}"
|
| 38 |
except Exception as e:
|
| 39 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 40 |
+
@tool
|
| 41 |
+
def get_stock_price(stock_info: str) -> str:
|
| 42 |
+
"""A tool that fetches the current stock prices.
|
| 43 |
+
Args:
|
| 44 |
+
stock_info: include changes, current price and etc).
|
| 45 |
+
"""
|
| 46 |
+
finnhub_client = finnhub.Client(api_key=apikey)
|
| 47 |
+
|
| 48 |
+
return finnhub_client.quote('AAPL'))
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
|
| 53 |
|
| 54 |
final_answer = FinalAnswerTool()
|