Spaces:
Configuration error
Configuration error
Add error handling for wrong urls
Browse files
app.py
CHANGED
|
@@ -25,7 +25,10 @@ def image_to_sam_image_embedding(
|
|
| 25 |
|
| 26 |
image_url = urllib.parse.unquote(image_url)
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
| 29 |
image = image.convert("RGB")
|
| 30 |
image = np.asarray(image)
|
| 31 |
|
|
|
|
| 25 |
|
| 26 |
image_url = urllib.parse.unquote(image_url)
|
| 27 |
|
| 28 |
+
try:
|
| 29 |
+
image = download_image(image_url)
|
| 30 |
+
except:
|
| 31 |
+
raise gr.Error(f"Could not find image with URL {image_url}")
|
| 32 |
image = image.convert("RGB")
|
| 33 |
image = np.asarray(image)
|
| 34 |
|