Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -132,7 +132,7 @@ def start_tryon(person_img, pose_img, mask_img, cloth_img, garment_des, denoise_
|
|
132 |
# Resize and prepare images
|
133 |
garm_img = cloth_img.convert("RGB").resize((768, 1024))
|
134 |
human_img = person_img.convert("RGB").resize((768, 1024))
|
135 |
-
mask = mask_img.convert("RGB").resize((768, 1024))
|
136 |
|
137 |
# Prepare pose image (already uploaded)
|
138 |
pose_img = pose_img.resize((768, 1024))
|
@@ -179,7 +179,6 @@ def start_tryon(person_img, pose_img, mask_img, cloth_img, garment_des, denoise_
|
|
179 |
# Convert images to tensors for processing
|
180 |
pose_img_tensor = tensor_transfrom(pose_img).unsqueeze(0).to(device, torch.float16)
|
181 |
garm_tensor = tensor_transfrom(garm_img).unsqueeze(0).to(device, torch.float16)
|
182 |
-
mask_tensor = tensor_transfrom(mask).unsqueeze(0).to(device, torch.float16)
|
183 |
|
184 |
# Prepare the generator with optional seed
|
185 |
generator = torch.Generator(device).manual_seed(seed) if seed is not None else None
|
@@ -196,7 +195,7 @@ def start_tryon(person_img, pose_img, mask_img, cloth_img, garment_des, denoise_
|
|
196 |
pose_img=pose_img_tensor.to(device, torch.float16),
|
197 |
text_embeds_cloth=prompt_embeds_cloth.to(device, torch.float16),
|
198 |
cloth=garm_tensor.to(device, torch.float16),
|
199 |
-
mask_image=
|
200 |
image=human_img,
|
201 |
height=1024,
|
202 |
width=768,
|
|
|
132 |
# Resize and prepare images
|
133 |
garm_img = cloth_img.convert("RGB").resize((768, 1024))
|
134 |
human_img = person_img.convert("RGB").resize((768, 1024))
|
135 |
+
mask = pil_to_binary_mask(mask_img.convert("RGB").resize((768, 1024)))
|
136 |
|
137 |
# Prepare pose image (already uploaded)
|
138 |
pose_img = pose_img.resize((768, 1024))
|
|
|
179 |
# Convert images to tensors for processing
|
180 |
pose_img_tensor = tensor_transfrom(pose_img).unsqueeze(0).to(device, torch.float16)
|
181 |
garm_tensor = tensor_transfrom(garm_img).unsqueeze(0).to(device, torch.float16)
|
|
|
182 |
|
183 |
# Prepare the generator with optional seed
|
184 |
generator = torch.Generator(device).manual_seed(seed) if seed is not None else None
|
|
|
195 |
pose_img=pose_img_tensor.to(device, torch.float16),
|
196 |
text_embeds_cloth=prompt_embeds_cloth.to(device, torch.float16),
|
197 |
cloth=garm_tensor.to(device, torch.float16),
|
198 |
+
mask_image=mask,
|
199 |
image=human_img,
|
200 |
height=1024,
|
201 |
width=768,
|