Spaces:
Configuration error
Configuration error
parokshsaxena
commited on
Commit
Β·
6cbe0ae
1
Parent(s):
08a2700
using image instead of image editor
Browse files
app.py
CHANGED
|
@@ -162,11 +162,9 @@ def start_tryon(human_img_dict,garm_img,garment_des, background_img, is_checked,
|
|
| 162 |
pipe.to(device)
|
| 163 |
pipe.unet_encoder.to(device)
|
| 164 |
# pipe.garment_net.to(device)
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
else:
|
| 169 |
-
human_img_orig = human_img_dict.convert("RGB") # Image
|
| 170 |
|
| 171 |
|
| 172 |
"""
|
|
@@ -320,15 +318,15 @@ human_list = os.listdir(os.path.join(example_path,"human"))
|
|
| 320 |
human_list_path = [os.path.join(example_path,"human",human) for human in human_list]
|
| 321 |
|
| 322 |
human_ex_list = []
|
| 323 |
-
|
| 324 |
-
|
| 325 |
for ex_human in human_list_path:
|
| 326 |
ex_dict= {}
|
| 327 |
ex_dict['background'] = ex_human
|
| 328 |
ex_dict['layers'] = None
|
| 329 |
ex_dict['composite'] = None
|
| 330 |
human_ex_list.append(ex_dict)
|
| 331 |
-
|
| 332 |
##default human
|
| 333 |
|
| 334 |
|
|
@@ -341,8 +339,8 @@ with image_blocks as demo:
|
|
| 341 |
with gr.Column():
|
| 342 |
# changing from ImageEditor to Image to allow easy passing of data through API
|
| 343 |
# instead of passing {"dictionary": <>} ( which is failing ), we can directly pass the image
|
| 344 |
-
imgs = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True)
|
| 345 |
-
|
| 346 |
with gr.Row():
|
| 347 |
is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)",value=True)
|
| 348 |
with gr.Row():
|
|
|
|
| 162 |
pipe.to(device)
|
| 163 |
pipe.unet_encoder.to(device)
|
| 164 |
# pipe.garment_net.to(device)
|
| 165 |
+
|
| 166 |
+
# human_img_orig = human_img_dict["background"].convert("RGB") # ImageEditor
|
| 167 |
+
human_img_orig = human_img_dict.convert("RGB") # Image
|
|
|
|
|
|
|
| 168 |
|
| 169 |
|
| 170 |
"""
|
|
|
|
| 318 |
human_list_path = [os.path.join(example_path,"human",human) for human in human_list]
|
| 319 |
|
| 320 |
human_ex_list = []
|
| 321 |
+
human_ex_list = human_list_path # Image
|
| 322 |
+
""" if using ImageEditor instead of Image while taking input, use this - ImageEditor
|
| 323 |
for ex_human in human_list_path:
|
| 324 |
ex_dict= {}
|
| 325 |
ex_dict['background'] = ex_human
|
| 326 |
ex_dict['layers'] = None
|
| 327 |
ex_dict['composite'] = None
|
| 328 |
human_ex_list.append(ex_dict)
|
| 329 |
+
"""
|
| 330 |
##default human
|
| 331 |
|
| 332 |
|
|
|
|
| 339 |
with gr.Column():
|
| 340 |
# changing from ImageEditor to Image to allow easy passing of data through API
|
| 341 |
# instead of passing {"dictionary": <>} ( which is failing ), we can directly pass the image
|
| 342 |
+
#imgs = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True)
|
| 343 |
+
imgs = gr.Image(sources='upload', type='pil',label='Human. Mask with pen or use auto-masking')
|
| 344 |
with gr.Row():
|
| 345 |
is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)",value=True)
|
| 346 |
with gr.Row():
|