Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,16 +9,17 @@ 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 get_pokemon_data(pokemon_name:str)-> str:
|
| 13 |
-
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
"""A tool that retrieves data about a pokemon
|
| 15 |
Args:
|
| 16 |
pokemon_name: the pokemon name
|
| 17 |
"""
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
+
def get_pokemon_data(pokemon_name:str)-> str:
|
|
|
|
| 13 |
"""A tool that retrieves data about a pokemon
|
| 14 |
Args:
|
| 15 |
pokemon_name: the pokemon name
|
| 16 |
"""
|
| 17 |
+
try:
|
| 18 |
+
response = requests.get(f"https://pokeapi.co/api/v2/pokemon/{pokemon_name}")
|
| 19 |
+
pokemon_data = response.json()
|
| 20 |
+
return pokemon_data
|
| 21 |
+
except Exception as e:
|
| 22 |
+
return f"Error fetching pokemon data for {pokemon_name}"
|
| 23 |
|
| 24 |
@tool
|
| 25 |
def get_current_time_in_timezone(timezone: str) -> str:
|