Update app.py
Browse files
app.py
CHANGED
@@ -152,10 +152,13 @@ def start_tryon(dict, garm_img, garment_des, is_checked, is_checked_crop, denois
|
|
152 |
mask, mask_gray = get_mask_location('hd', category, model_parse, keypoints)
|
153 |
mask = mask.resize((768,1024))
|
154 |
except NotImplementedError:
|
155 |
-
status_message = f"μΉ΄ν
κ³ λ¦¬ {category}μ λν μλ λ§μ€ν¬ μμ±μ΄ ꡬνλμ§ μμμ΅λλ€.
|
156 |
-
mask =
|
157 |
else:
|
158 |
-
|
|
|
|
|
|
|
159 |
|
160 |
mask_gray = (1-transforms.ToTensor()(mask)) * tensor_transfrom(human_img)
|
161 |
mask_gray = to_pil_image((mask_gray+1.0)/2.0)
|
@@ -225,7 +228,12 @@ def start_tryon(dict, garm_img, garment_des, is_checked, is_checked_crop, denois
|
|
225 |
width=768,
|
226 |
ip_adapter_image = garm_img.resize((768,1024)),
|
227 |
guidance_scale=2.0,
|
228 |
-
)
|
|
|
|
|
|
|
|
|
|
|
229 |
|
230 |
if is_checked_crop:
|
231 |
out_img = images[0].resize(crop_size)
|
@@ -294,9 +302,11 @@ with image_blocks as demo:
|
|
294 |
with gr.Column():
|
295 |
status_message = gr.Textbox(label="μν", interactive=False)
|
296 |
|
|
|
|
|
297 |
try_button.click(fn=start_tryon,
|
298 |
inputs=[imgs, garm_img, prompt, is_checked, is_checked_crop, denoise_steps, seed, category],
|
299 |
outputs=[image_out, masked_img, status_message],
|
300 |
api_name='tryon')
|
301 |
|
302 |
-
image_blocks.launch(auth=("gini","pick"))
|
|
|
152 |
mask, mask_gray = get_mask_location('hd', category, model_parse, keypoints)
|
153 |
mask = mask.resize((768,1024))
|
154 |
except NotImplementedError:
|
155 |
+
status_message = f"μΉ΄ν
κ³ λ¦¬ {category}μ λν μλ λ§μ€ν¬ μμ±μ΄ ꡬνλμ§ μμμ΅λλ€. κΈ°λ³Έ λ§μ€ν¬λ₯Ό μ¬μ©ν©λλ€."
|
156 |
+
mask = Image.new('L', (768, 1024), 255)
|
157 |
else:
|
158 |
+
if dict['layers'] and dict['layers'][0]:
|
159 |
+
mask = pil_to_binary_mask(dict['layers'][0].convert("RGB").resize((768, 1024)))
|
160 |
+
else:
|
161 |
+
mask = Image.new('L', (768, 1024), 255)
|
162 |
|
163 |
mask_gray = (1-transforms.ToTensor()(mask)) * tensor_transfrom(human_img)
|
164 |
mask_gray = to_pil_image((mask_gray+1.0)/2.0)
|
|
|
228 |
width=768,
|
229 |
ip_adapter_image = garm_img.resize((768,1024)),
|
230 |
guidance_scale=2.0,
|
231 |
+
).images
|
232 |
+
|
233 |
+
print(f"Mask shape: {mask.size}")
|
234 |
+
print(f"Human image shape: {human_img.size}")
|
235 |
+
print(f"Garment image shape: {garm_img.size}")
|
236 |
+
print(f"Output image shape: {images[0].size}")
|
237 |
|
238 |
if is_checked_crop:
|
239 |
out_img = images[0].resize(crop_size)
|
|
|
302 |
with gr.Column():
|
303 |
status_message = gr.Textbox(label="μν", interactive=False)
|
304 |
|
305 |
+
|
306 |
+
|
307 |
try_button.click(fn=start_tryon,
|
308 |
inputs=[imgs, garm_img, prompt, is_checked, is_checked_crop, denoise_steps, seed, category],
|
309 |
outputs=[image_out, masked_img, status_message],
|
310 |
api_name='tryon')
|
311 |
|
312 |
+
image_blocks.launch(auth=("gini","pick"))
|