Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -93,7 +93,7 @@ def start_tryon(img,garm_img,garment_des,cloth_type,is_checked,is_checked_crop,d
|
|
93 |
pipe.unet_encoder.to(device)
|
94 |
|
95 |
garm_img= garm_img.convert("RGB").resize((768,1024))
|
96 |
-
human_img_orig = img
|
97 |
|
98 |
if is_checked_crop:
|
99 |
width, height = human_img_orig.size
|
@@ -204,7 +204,9 @@ def main_(imgs,topwear_img,topwear_des,bottomwear_img,bottomwear_des,dress_img,d
|
|
204 |
return start_tryon(imgs,bottomwear_img,bottomwear_des,"lower_body",is_checked,is_checked_crop,denoise_steps,seed)
|
205 |
elif topwear_img!=None and bottomwear_img!=None:
|
206 |
_, half_img, half_mask = start_tryon(imgs,topwear_img,topwear_des,"upper_body",is_checked,is_checked_crop,denoise_steps,seed)
|
207 |
-
|
|
|
|
|
208 |
|
209 |
|
210 |
garm_list = os.listdir(os.path.join(example_path,"cloth"))
|
@@ -230,7 +232,7 @@ with image_blocks as demo:
|
|
230 |
gr.HTML("<center><p>Upload an image of a person and images of the clothes✨</p></center>")
|
231 |
with gr.Row():
|
232 |
with gr.Column():
|
233 |
-
inp_img = gr.ImageEditor(sources='upload',type="pil",label='Human. Mask with pen or use auto-masking',
|
234 |
with gr.Row():
|
235 |
is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)",value=True)
|
236 |
with gr.Row():
|
|
|
93 |
pipe.unet_encoder.to(device)
|
94 |
|
95 |
garm_img= garm_img.convert("RGB").resize((768,1024))
|
96 |
+
human_img_orig = img["background"].convert("RGB")
|
97 |
|
98 |
if is_checked_crop:
|
99 |
width, height = human_img_orig.size
|
|
|
204 |
return start_tryon(imgs,bottomwear_img,bottomwear_des,"lower_body",is_checked,is_checked_crop,denoise_steps,seed)
|
205 |
elif topwear_img!=None and bottomwear_img!=None:
|
206 |
_, half_img, half_mask = start_tryon(imgs,topwear_img,topwear_des,"upper_body",is_checked,is_checked_crop,denoise_steps,seed)
|
207 |
+
half_dict= {}
|
208 |
+
half_dict['background'],half_dict['layers'],half_dict['composite'] = half_img,None,None
|
209 |
+
return start_tryon(half_dict,bottomwear_img,bottomwear_des,"lower_body",is_checked,is_checked_crop,denoise_steps,seed)
|
210 |
|
211 |
|
212 |
garm_list = os.listdir(os.path.join(example_path,"cloth"))
|
|
|
232 |
gr.HTML("<center><p>Upload an image of a person and images of the clothes✨</p></center>")
|
233 |
with gr.Row():
|
234 |
with gr.Column():
|
235 |
+
inp_img = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True)
|
236 |
with gr.Row():
|
237 |
is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)",value=True)
|
238 |
with gr.Row():
|