Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -143,11 +143,12 @@ def function(Textbox,Textbox2,Textbox3):
|
|
143 |
try:
|
144 |
response = requests.get(f"https://api.placid.app/u/pydav4ibo?quote[text]={reply}")
|
145 |
print(f'Response HTTP Status Code: {response.status_code}')
|
146 |
-
|
|
|
147 |
image_array = np.array(image)
|
148 |
return image_array
|
149 |
-
except requests.exceptions.RequestException:
|
150 |
-
print('HTTP Request failed')
|
151 |
|
152 |
if Textbox3 == target:
|
153 |
Textbox2 = Textbox2.replace("[", "").replace("]", "").replace("'", "")
|
|
|
143 |
try:
|
144 |
response = requests.get(f"https://api.placid.app/u/pydav4ibo?quote[text]={reply}")
|
145 |
print(f'Response HTTP Status Code: {response.status_code}')
|
146 |
+
response.raise_for_status()
|
147 |
+
image = Image.open(BytesIO(response.content))
|
148 |
image_array = np.array(image)
|
149 |
return image_array
|
150 |
+
except requests.exceptions.RequestException as e:
|
151 |
+
print('HTTP Request failed:', str(e))
|
152 |
|
153 |
if Textbox3 == target:
|
154 |
Textbox2 = Textbox2.replace("[", "").replace("]", "").replace("'", "")
|