parokshsaxena commited on
Commit
0246478
β€’
1 Parent(s): 52a4bac

using image editor

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -152,8 +152,8 @@ def start_tryon(human_img_dict,garm_img,garment_des, background_img, is_checked,
152
  pipe.to(device)
153
  pipe.unet_encoder.to(device)
154
 
155
- #human_img_orig = human_img_dict["background"].convert("RGB") # ImageEditor
156
- human_img_orig = human_img_dict.convert("RGB") # Image
157
 
158
 
159
  """
@@ -303,15 +303,15 @@ human_list = os.listdir(os.path.join(example_path,"human"))
303
  human_list_path = [os.path.join(example_path,"human",human) for human in human_list]
304
 
305
  human_ex_list = []
306
- human_ex_list = human_list_path # Image
307
- """ if using ImageEditor instead of Image while taking input, use this - ImageEditor
308
  for ex_human in human_list_path:
309
  ex_dict= {}
310
  ex_dict['background'] = ex_human
311
  ex_dict['layers'] = None
312
  ex_dict['composite'] = None
313
  human_ex_list.append(ex_dict)
314
- """
315
  ##default human
316
 
317
 
@@ -324,8 +324,8 @@ with image_blocks as demo:
324
  with gr.Column():
325
  # changing from ImageEditor to Image to allow easy passing of data through API
326
  # instead of passing {"dictionary": <>} ( which is failing ), we can directly pass the image
327
- #imgs = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True)
328
- imgs = gr.Image(sources='upload', type='pil',label='Human. Mask with pen or use auto-masking')
329
  with gr.Row():
330
  is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)",value=True)
331
  with gr.Row():
 
152
  pipe.to(device)
153
  pipe.unet_encoder.to(device)
154
 
155
+ human_img_orig = human_img_dict["background"].convert("RGB") # ImageEditor
156
+ #human_img_orig = human_img_dict.convert("RGB") # Image
157
 
158
 
159
  """
 
303
  human_list_path = [os.path.join(example_path,"human",human) for human in human_list]
304
 
305
  human_ex_list = []
306
+ #human_ex_list = human_list_path # Image
307
+ #""" if using ImageEditor instead of Image while taking input, use this - ImageEditor
308
  for ex_human in human_list_path:
309
  ex_dict= {}
310
  ex_dict['background'] = ex_human
311
  ex_dict['layers'] = None
312
  ex_dict['composite'] = None
313
  human_ex_list.append(ex_dict)
314
+ #"""
315
  ##default human
316
 
317
 
 
324
  with gr.Column():
325
  # changing from ImageEditor to Image to allow easy passing of data through API
326
  # instead of passing {"dictionary": <>} ( which is failing ), we can directly pass the image
327
+ imgs = gr.ImageEditor(sources='upload', type="pil", label='Human. Mask with pen or use auto-masking', interactive=True)
328
+ #imgs = gr.Image(sources='upload', type='pil',label='Human. Mask with pen or use auto-masking')
329
  with gr.Row():
330
  is_checked = gr.Checkbox(label="Yes", info="Use auto-generated mask (Takes 5 seconds)",value=True)
331
  with gr.Row():