Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,7 +5,9 @@ import pytz
|
|
| 5 |
import yaml
|
| 6 |
import yfinance as yf
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
-
|
|
|
|
|
|
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
@@ -36,11 +38,11 @@ def get_stock_information(stock:str) -> str:
|
|
| 36 |
|
| 37 |
|
| 38 |
@tool
|
| 39 |
-
def get_radio_station(country:str)->
|
| 40 |
''' this function fetches streams to radio stations for country, it print str urls addresses
|
| 41 |
Args:
|
| 42 |
country:A string representing a valid country (e.g., 'us')
|
| 43 |
-
Return:
|
| 44 |
'''
|
| 45 |
try:
|
| 46 |
conn = http.client.HTTPSConnection("50k-radio-stations.p.rapidapi.com")
|
|
@@ -50,7 +52,7 @@ def get_radio_station(country:str)->str:
|
|
| 50 |
"x-rapidapi-host": "50k-radio-stations.p.rapidapi.com",
|
| 51 |
}
|
| 52 |
|
| 53 |
-
conn.request("GET", f"/radios/popular/{country}?limit=
|
| 54 |
res = conn.getresponse()
|
| 55 |
dt = json.loads(res.read().decode("utf-8"))
|
| 56 |
|
|
|
|
| 5 |
import yaml
|
| 6 |
import yfinance as yf
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
+
import http.client
|
| 9 |
+
import json
|
| 10 |
+
from transformers import tool
|
| 11 |
from Gradio_UI import GradioUI
|
| 12 |
|
| 13 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |
@tool
|
| 41 |
+
def get_radio_station(country:str)->list:
|
| 42 |
''' this function fetches streams to radio stations for country, it print str urls addresses
|
| 43 |
Args:
|
| 44 |
country:A string representing a valid country (e.g., 'us')
|
| 45 |
+
Return: list
|
| 46 |
'''
|
| 47 |
try:
|
| 48 |
conn = http.client.HTTPSConnection("50k-radio-stations.p.rapidapi.com")
|
|
|
|
| 52 |
"x-rapidapi-host": "50k-radio-stations.p.rapidapi.com",
|
| 53 |
}
|
| 54 |
|
| 55 |
+
conn.request("GET", f"/radios/popular/{country}?limit=10", headers=headers)
|
| 56 |
res = conn.getresponse()
|
| 57 |
dt = json.loads(res.read().decode("utf-8"))
|
| 58 |
|