doevent commited on
Commit
09a79cf
1 Parent(s): 6987132

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -20,13 +20,13 @@ def setup_model(args):
20
 
21
  return model
22
 
23
- def main(img):
24
 
25
  # Checking Image Aspect Ratio
26
- with Image.open(img) as im:
27
- #image size
28
- ratio_width = im.size[0]
29
- ratio_height = im.size[1]
30
  print(f"Aspect ratio: {ratio_width}x{ratio_height} px")
31
  if ratio_width >= 1026 or ratio_height >= 1026:
32
  raise gr.Error("Image aspect ratio must not exceed width: 1024 px and height: 1024 px.")
 
20
 
21
  return model
22
 
23
+ def main(img: Image):
24
 
25
  # Checking Image Aspect Ratio
26
+ load_img = Image.fromarray(img)
27
+ #image size
28
+ ratio_width = load_img.size[0]
29
+ ratio_height = load_img.size[1]
30
  print(f"Aspect ratio: {ratio_width}x{ratio_height} px")
31
  if ratio_width >= 1026 or ratio_height >= 1026:
32
  raise gr.Error("Image aspect ratio must not exceed width: 1024 px and height: 1024 px.")