nolenfelten commited on
Commit
c039d57
·
verified ·
1 Parent(s): b38b392

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -273,8 +273,20 @@ def object_detection_density_edge(image, conf_threshold=0.25, iou_threshold=0.45
273
 
274
 
275
  # Function to resize and encode an image
276
- def resize_image(image, max_size=1500):
277
  print("resize_image initialized")
 
 
 
 
 
 
 
 
 
 
 
 
278
 
279
 
280
  print("Create io.BytesIO instance")
 
273
 
274
 
275
  # Function to resize and encode an image
276
+ def resize_image(image, max_size=3000):
277
  print("resize_image initialized")
278
+ if max(image.size) > max_size:
279
+
280
+ print("Image size is over the max size, resizing")
281
+ ratio = max_size / float(max(image.size))
282
+ print("Ratio is: " + str(ratio))
283
+
284
+ new_size = tuple([int(x * ratio) for x in image.size])
285
+ print("New size is: " + str(new_size))
286
+
287
+ print("Resizing image")
288
+ image = image.resize(new_size, Image.LANCZOS)
289
+
290
 
291
 
292
  print("Create io.BytesIO instance")