Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -163,12 +163,11 @@ def submit_function(
|
|
163 |
else:
|
164 |
mask = automasker(
|
165 |
person_image,
|
166 |
-
cloth_type
|
167 |
)['mask']
|
168 |
mask = mask_processor.blur(mask, blur_factor=9)
|
169 |
|
170 |
# Inference
|
171 |
-
# try:
|
172 |
result_image = pipeline(
|
173 |
image=person_image,
|
174 |
condition_image=cloth_image,
|
@@ -177,10 +176,6 @@ def submit_function(
|
|
177 |
guidance_scale=guidance_scale,
|
178 |
generator=generator
|
179 |
)[0]
|
180 |
-
# except Exception as e:
|
181 |
-
# raise gr.Error(
|
182 |
-
# "An error occurred. Please try again later: {}".format(e)
|
183 |
-
# )
|
184 |
|
185 |
# Post-process
|
186 |
masked_person = vis_mask(person_image, mask)
|
@@ -195,7 +190,7 @@ def submit_function(
|
|
195 |
conditions = image_grid([person_image, cloth_image], 2, 1)
|
196 |
else:
|
197 |
condition_width = width // 3
|
198 |
-
conditions = image_grid([person_image, masked_person
|
199 |
conditions = conditions.resize((condition_width, height), Image.NEAREST)
|
200 |
new_result_image = Image.new("RGB", (width + condition_width + 6, height))
|
201 |
new_result_image.paste(conditions, (0, 0))
|
@@ -241,7 +236,7 @@ def app_gradio():
|
|
241 |
)
|
242 |
cloth_type = gr.Radio(
|
243 |
label="Try-On Cloth Type",
|
244 |
-
choices=["upper", "lower", "overall"],
|
245 |
value="upper",
|
246 |
)
|
247 |
|
|
|
163 |
else:
|
164 |
mask = automasker(
|
165 |
person_image,
|
166 |
+
cloth_type # This will now include 'bags' and 'footwear'
|
167 |
)['mask']
|
168 |
mask = mask_processor.blur(mask, blur_factor=9)
|
169 |
|
170 |
# Inference
|
|
|
171 |
result_image = pipeline(
|
172 |
image=person_image,
|
173 |
condition_image=cloth_image,
|
|
|
176 |
guidance_scale=guidance_scale,
|
177 |
generator=generator
|
178 |
)[0]
|
|
|
|
|
|
|
|
|
179 |
|
180 |
# Post-process
|
181 |
masked_person = vis_mask(person_image, mask)
|
|
|
190 |
conditions = image_grid([person_image, cloth_image], 2, 1)
|
191 |
else:
|
192 |
condition_width = width // 3
|
193 |
+
conditions = image_grid([person_image, masked_person, cloth_image], 3, 1)
|
194 |
conditions = conditions.resize((condition_width, height), Image.NEAREST)
|
195 |
new_result_image = Image.new("RGB", (width + condition_width + 6, height))
|
196 |
new_result_image.paste(conditions, (0, 0))
|
|
|
236 |
)
|
237 |
cloth_type = gr.Radio(
|
238 |
label="Try-On Cloth Type",
|
239 |
+
choices=["upper", "lower", "overall", "bags", "footwear"],
|
240 |
value="upper",
|
241 |
)
|
242 |
|