Spaces:
Sleeping
Sleeping
Update app.py
Browse filesremove cat image tool
app.py
CHANGED
@@ -63,33 +63,6 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
63 |
# return f"Error fetching quote: {str(e)}"
|
64 |
|
65 |
|
66 |
-
@tool
|
67 |
-
def random_cat_image() -> image:
|
68 |
-
"""
|
69 |
-
Fetches a random cat image from aws.random.cat.
|
70 |
-
This function sends a GET request to the api to retrieve a random cat image.
|
71 |
-
If the request fails or the response does not contain a cat image, an error message is returned.
|
72 |
-
Returns:
|
73 |
-
image: The cat image, or an error message if the image could not be fetched.
|
74 |
-
"""
|
75 |
-
url = "https://aws.random.cat/meow"
|
76 |
-
|
77 |
-
try:
|
78 |
-
response = requests.get(url)
|
79 |
-
response.raise_for_status()
|
80 |
-
|
81 |
-
data = response.json()
|
82 |
-
|
83 |
-
if "image" in data:
|
84 |
-
return data["image"]
|
85 |
-
elif "setup" in data and "delivery" in data:
|
86 |
-
return f"{data['setup']} - {data['delivery']}"
|
87 |
-
else:
|
88 |
-
return "Error: Unable to fetch cat image."
|
89 |
-
|
90 |
-
except requests.exceptions.RequestException as e:
|
91 |
-
return f"Error fetching cat image: {str(e)}"
|
92 |
-
|
93 |
@tool
|
94 |
def get_joke() -> str:
|
95 |
"""
|
|
|
63 |
# return f"Error fetching quote: {str(e)}"
|
64 |
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
@tool
|
67 |
def get_joke() -> str:
|
68 |
"""
|