Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ from Gradio_UI import GradioUI
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
-
def nba_player_tool(playerName:str)->
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
"""A tool that that fetches data from a specific nba player
|
| 16 |
Args:
|
|
@@ -26,17 +26,13 @@ def nba_player_tool(playerName:str)-> json: #it's import to specify the return t
|
|
| 26 |
# Verifica si la solicitud fue exitosa (código 200)
|
| 27 |
response.raise_for_status() # Lanza una excepción para errores HTTP
|
| 28 |
data = response.json()
|
| 29 |
-
|
| 30 |
-
# Imprime los nombres de los personajes
|
| 31 |
-
return f"Data for player: {playerName}: {data['results']}"
|
| 32 |
|
| 33 |
-
|
| 34 |
except requests.exceptions.RequestException as e:
|
| 35 |
return f"Error en la solicitud: {e}"
|
| 36 |
except json.JSONDecodeError as e:
|
| 37 |
return f"Error al decodificar JSON: {e}"
|
| 38 |
|
| 39 |
-
return "What magic will you build ?"
|
| 40 |
|
| 41 |
@tool
|
| 42 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def nba_player_tool(playerName:str)-> str: #it's import to specify the return type
|
| 14 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 15 |
"""A tool that that fetches data from a specific nba player
|
| 16 |
Args:
|
|
|
|
| 26 |
# Verifica si la solicitud fue exitosa (código 200)
|
| 27 |
response.raise_for_status() # Lanza una excepción para errores HTTP
|
| 28 |
data = response.json()
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
f"Data for player: {playerName}: {data['results']}"
|
| 31 |
except requests.exceptions.RequestException as e:
|
| 32 |
return f"Error en la solicitud: {e}"
|
| 33 |
except json.JSONDecodeError as e:
|
| 34 |
return f"Error al decodificar JSON: {e}"
|
| 35 |
|
|
|
|
| 36 |
|
| 37 |
@tool
|
| 38 |
def get_current_time_in_timezone(timezone: str) -> str:
|