ahuang11 commited on
Commit
8ca62d2
β€’
1 Parent(s): 86bb9ef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -67,8 +67,12 @@ async def process_inputs(class_names: List[str], image_url: str):
67
  return
68
 
69
  yield "##### βš™ Fetching image and running model..."
70
- pil_img = await open_image_url(image_url)
71
- img = pn.pane.Image(pil_img, height=400, align="center")
 
 
 
 
72
 
73
  class_items = class_names.split(",")
74
  class_likelihoods = get_similarity_scores(class_items, pil_img)
 
67
  return
68
 
69
  yield "##### βš™ Fetching image and running model..."
70
+ try:
71
+ pil_img = await open_image_url(image_url)
72
+ img = pn.pane.Image(pil_img, height=400, align="center")
73
+ except Exception as e:
74
+ yield f"##### πŸ˜” Something went wrong, please try a different URL!"
75
+ return
76
 
77
  class_items = class_names.split(",")
78
  class_likelihoods = get_similarity_scores(class_items, pil_img)