Spaces:
Runtime error
Runtime error
Update utils/utils.py
Browse files- utils/utils.py +1 -1
utils/utils.py
CHANGED
|
@@ -22,7 +22,7 @@ def conventional_resize(img):
|
|
| 22 |
3/4: (896, 1152)
|
| 23 |
}
|
| 24 |
|
| 25 |
-
closest_aspect_ratio =
|
| 26 |
new_width, new_height = conventional_sizes[closest_aspect_ratio]
|
| 27 |
|
| 28 |
resized_img = img.resize((new_width, new_height), Image.LANCZOS)
|
|
|
|
| 22 |
3/4: (896, 1152)
|
| 23 |
}
|
| 24 |
|
| 25 |
+
closest_aspect_ratio = min(conventional_sizes.keys(), key=lambda x: abs(x - aspect_ratio)) #1.333333333 #
|
| 26 |
new_width, new_height = conventional_sizes[closest_aspect_ratio]
|
| 27 |
|
| 28 |
resized_img = img.resize((new_width, new_height), Image.LANCZOS)
|