Spaces:
Sleeping
Sleeping
patrickligardes
commited on
Commit
β’
0fc995e
1
Parent(s):
01e394b
Update app.py
Browse files
app.py
CHANGED
@@ -141,15 +141,19 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
141 |
|
142 |
if is_checked_crop:
|
143 |
width, height = human_img_orig.size
|
144 |
-
target_width =
|
145 |
-
target_height =
|
|
|
|
|
|
|
|
|
|
|
146 |
left = (width - target_width) / 2
|
147 |
top = (height - target_height) / 2
|
148 |
right = (width + target_width) / 2
|
149 |
bottom = (height + target_height) / 2
|
150 |
cropped_img = human_img_orig.crop((left, top, right, bottom))
|
151 |
-
|
152 |
-
human_img = cropped_img.resize((768,1024))
|
153 |
else:
|
154 |
human_img = human_img_orig.resize((768,1024))
|
155 |
|
|
|
141 |
|
142 |
if is_checked_crop:
|
143 |
width, height = human_img_orig.size
|
144 |
+
target_width = width
|
145 |
+
target_height = height
|
146 |
+
if width > height * (3 / 4):
|
147 |
+
target_width = int(height * (3 / 4))
|
148 |
+
else:
|
149 |
+
target_height = int(width * (4 / 3))
|
150 |
+
|
151 |
left = (width - target_width) / 2
|
152 |
top = (height - target_height) / 2
|
153 |
right = (width + target_width) / 2
|
154 |
bottom = (height + target_height) / 2
|
155 |
cropped_img = human_img_orig.crop((left, top, right, bottom))
|
156 |
+
human_img = cropped_img.resize((768, 1024))
|
|
|
157 |
else:
|
158 |
human_img = human_img_orig.resize((768,1024))
|
159 |
|