Spaces:
Runtime error
Runtime error
input img components
Browse files
app.py
CHANGED
|
@@ -131,7 +131,8 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
| 131 |
|
| 132 |
garm_img= garm_img.convert("RGB").resize((768,1024))
|
| 133 |
|
| 134 |
-
human_img_orig = dict
|
|
|
|
| 135 |
|
| 136 |
if is_checked_crop:
|
| 137 |
width, height = human_img_orig.size
|
|
@@ -153,8 +154,8 @@ def start_tryon(dict,garm_img,garment_des,is_checked,is_checked_crop,denoise_ste
|
|
| 153 |
model_parse, _ = parsing_model(human_img.resize((384,512)))
|
| 154 |
mask, mask_gray = get_mask_location('hd', "upper_body", model_parse, keypoints)
|
| 155 |
mask = mask.resize((768,1024))
|
| 156 |
-
else:
|
| 157 |
-
mask = pil_to_binary_mask(dict['layers'][0].convert("RGB").resize((768, 1024)))
|
| 158 |
# mask = transforms.ToTensor()(mask)
|
| 159 |
# mask = mask.unsqueeze(0)
|
| 160 |
mask_gray = (1-transforms.ToTensor()(mask)) * tensor_transfrom(human_img)
|
|
@@ -265,7 +266,8 @@ with image_blocks as demo:
|
|
| 265 |
gr.Markdown("Virtual Try-on with your image and garment image. Check out the [source codes](https://github.com/yisol/IDM-VTON) and the [model](https://huggingface.co/yisol/IDM-VTON)")
|
| 266 |
with gr.Row():
|
| 267 |
with gr.Column():
|
| 268 |
-
imgs = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True)
|
|
|
|
| 269 |
garm_img = gr.Image(label="Garment", sources='upload', type="pil")
|
| 270 |
with gr.Row(elem_id="prompt-container"):
|
| 271 |
with gr.Row():
|
|
|
|
| 131 |
|
| 132 |
garm_img= garm_img.convert("RGB").resize((768,1024))
|
| 133 |
|
| 134 |
+
human_img_orig = dict.convert("RGB").resize((768,1024))
|
| 135 |
+
# human_img_orig = dict["background"].convert("RGB")
|
| 136 |
|
| 137 |
if is_checked_crop:
|
| 138 |
width, height = human_img_orig.size
|
|
|
|
| 154 |
model_parse, _ = parsing_model(human_img.resize((384,512)))
|
| 155 |
mask, mask_gray = get_mask_location('hd', "upper_body", model_parse, keypoints)
|
| 156 |
mask = mask.resize((768,1024))
|
| 157 |
+
# else:
|
| 158 |
+
# mask = pil_to_binary_mask(dict['layers'][0].convert("RGB").resize((768, 1024)))
|
| 159 |
# mask = transforms.ToTensor()(mask)
|
| 160 |
# mask = mask.unsqueeze(0)
|
| 161 |
mask_gray = (1-transforms.ToTensor()(mask)) * tensor_transfrom(human_img)
|
|
|
|
| 266 |
gr.Markdown("Virtual Try-on with your image and garment image. Check out the [source codes](https://github.com/yisol/IDM-VTON) and the [model](https://huggingface.co/yisol/IDM-VTON)")
|
| 267 |
with gr.Row():
|
| 268 |
with gr.Column():
|
| 269 |
+
# imgs = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True)
|
| 270 |
+
imgs = gr.Image(label='Human', sources='upload', type="pil")
|
| 271 |
garm_img = gr.Image(label="Garment", sources='upload', type="pil")
|
| 272 |
with gr.Row(elem_id="prompt-container"):
|
| 273 |
with gr.Row():
|