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