Spaces:
Running
on
Zero
Running
on
Zero
parokshsaxena
commited on
Commit
β’
4191c16
1
Parent(s):
fa463a7
resizing to original size as per the IDM model, moving category as variable
Browse files
app.py
CHANGED
@@ -123,11 +123,13 @@ pipe.unet_encoder = UNet_Encoder
|
|
123 |
|
124 |
#WIDTH = int(4160/4) # 768
|
125 |
#HEIGHT = int(6240/4) # 1024
|
126 |
-
WIDTH = int(768
|
127 |
-
HEIGHT = int(1024
|
128 |
POSE_WIDTH = int(WIDTH/2) # int(WIDTH/2)
|
129 |
POSE_HEIGHT = int(HEIGHT/2) #int(HEIGHT/2)
|
130 |
|
|
|
|
|
131 |
@spaces.GPU
|
132 |
def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_steps,seed):
|
133 |
device = "cuda"
|
@@ -156,9 +158,11 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
156 |
|
157 |
|
158 |
if is_checked:
|
|
|
159 |
keypoints = openpose_model(human_img.resize((POSE_WIDTH, POSE_HEIGHT)))
|
160 |
model_parse, _ = parsing_model(human_img.resize((POSE_WIDTH, POSE_HEIGHT)))
|
161 |
-
mask
|
|
|
162 |
mask = mask.resize((WIDTH, HEIGHT))
|
163 |
logging.info("Mask location on model identified")
|
164 |
else:
|
|
|
123 |
|
124 |
#WIDTH = int(4160/4) # 768
|
125 |
#HEIGHT = int(6240/4) # 1024
|
126 |
+
WIDTH = int(768)
|
127 |
+
HEIGHT = int(1024)
|
128 |
POSE_WIDTH = int(WIDTH/2) # int(WIDTH/2)
|
129 |
POSE_HEIGHT = int(HEIGHT/2) #int(HEIGHT/2)
|
130 |
|
131 |
+
CATEGORY = "upper_body" # "lower_body"
|
132 |
+
|
133 |
@spaces.GPU
|
134 |
def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_steps,seed):
|
135 |
device = "cuda"
|
|
|
158 |
|
159 |
|
160 |
if is_checked:
|
161 |
+
# internally openpose_model is resizing human_img to resolution 384 if not passed as input
|
162 |
keypoints = openpose_model(human_img.resize((POSE_WIDTH, POSE_HEIGHT)))
|
163 |
model_parse, _ = parsing_model(human_img.resize((POSE_WIDTH, POSE_HEIGHT)))
|
164 |
+
# internally get mask location function is resizing model_parse to 384x512 if width & height not passed
|
165 |
+
mask, mask_gray = get_mask_location('hd', CATEGORY, model_parse, keypoints)
|
166 |
mask = mask.resize((WIDTH, HEIGHT))
|
167 |
logging.info("Mask location on model identified")
|
168 |
else:
|