baudm commited on
Commit
4900d6a
1 Parent(s): dcc140e

Handle empty image input

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -43,6 +43,8 @@ class App:
43
  return model
44
 
45
  def __call__(self, model_name, image):
 
 
46
  model = self._get_model(model_name)
47
  image = self._preprocess(image.convert('RGB')).unsqueeze(0)
48
  # Greedy decoding
 
43
  return model
44
 
45
  def __call__(self, model_name, image):
46
+ if image is None:
47
+ return ''
48
  model = self._get_model(model_name)
49
  image = self._preprocess(image.convert('RGB')).unsqueeze(0)
50
  # Greedy decoding