Update app.py
Browse files
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 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
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.")
|