Stefan Scholz commited on
Commit
dccb1c9
·
1 Parent(s): 9c18c98

resize large images

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. requirements.txt +1 -1
app.py CHANGED
@@ -240,8 +240,10 @@ def predict(image, vocabulary, feature_aggregation):
240
  :return:
241
  """
242
 
243
- # load image
244
- image = np.array(image.convert('RGB'))
 
 
245
 
246
  # check vocabulary
247
  if vocabulary == "COCO":
 
240
  :return:
241
  """
242
 
243
+ # convert image and resize if necessary
244
+ image = image.convert('RGB')
245
+ image.thumbnail((2000, 2000), Image.LANCZOS)
246
+ image = np.array(image)
247
 
248
  # check vocabulary
249
  if vocabulary == "COCO":
requirements.txt CHANGED
@@ -13,4 +13,4 @@ torch==1.13.0
13
  torchvision==0.14.0
14
  xgboost==2.0.3
15
  requests==2.31.0
16
- gradio==4.44.0
 
13
  torchvision==0.14.0
14
  xgboost==2.0.3
15
  requests==2.31.0
16
+ gradio==4.43.0