segments-arnaud commited on
Commit
a8366cc
1 Parent(s): e9da765

Add error handling for wrong urls

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -25,7 +25,10 @@ def image_to_sam_image_embedding(
25
 
26
  image_url = urllib.parse.unquote(image_url)
27
 
28
- image = download_image(image_url)
 
 
 
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