baudm commited on
Commit
d1f7105
1 Parent(s): 4afaded

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