NikhilJoson commited on
Commit
0514626
·
verified ·
1 Parent(s): 7c5b028

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -19,6 +19,7 @@ from preprocess.humanparsing.run_parsing import Parsing
19
  from preprocess.openpose.run_openpose import OpenPose
20
  from detectron2.data.detection_utils import convert_PIL_to_numpy,_apply_exif_orientation
21
  from torchvision.transforms.functional import to_pil_image
 
22
 
23
 
24
  def pil_to_binary_mask(pil_image, threshold=0):
@@ -203,7 +204,9 @@ def main_(imgs,topwear_img,topwear_des,bottomwear_img,bottomwear_des,dress_img,d
203
  return start_tryon(imgs,bottomwear_img,bottomwear_des,"lower_body",is_checked,is_checked_crop,denoise_steps,seed)
204
  elif topwear_img!=None and bottomwear_img!=None:
205
  _, half_img, half_mask = start_tryon(imgs,topwear_img,topwear_des,"upper_body",is_checked,is_checked_crop,denoise_steps,seed)
206
- return start_tryon(half_img,bottomwear_img,bottomwear_des,"lower_body",is_checked,is_checked_crop,denoise_steps,seed)
 
 
207
 
208
 
209
  garm_list = os.listdir(os.path.join(example_path,"cloth"))
@@ -223,7 +226,7 @@ for ex_human in human_list_path:
223
  ##default human
224
 
225
 
226
- image_blocks = gr.Blocks(theme="Nymbo/Alyx_Theme").queue()
227
  with image_blocks as demo:
228
  gr.HTML("<center><h1>Virtual Try-On</h1></center>")
229
  gr.HTML("<center><p>Upload an image of a person and images of the clothes✨</p></center>")
@@ -266,7 +269,7 @@ with image_blocks as demo:
266
 
267
 
268
  with gr.Column():
269
- try_button = gr.Button(value="Try-on")
270
  with gr.Accordion(label="Advanced Settings", open=False):
271
  with gr.Row():
272
  denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)
 
19
  from preprocess.openpose.run_openpose import OpenPose
20
  from detectron2.data.detection_utils import convert_PIL_to_numpy,_apply_exif_orientation
21
  from torchvision.transforms.functional import to_pil_image
22
+ from datasets import Dataset
23
 
24
 
25
  def pil_to_binary_mask(pil_image, threshold=0):
 
204
  return start_tryon(imgs,bottomwear_img,bottomwear_des,"lower_body",is_checked,is_checked_crop,denoise_steps,seed)
205
  elif topwear_img!=None and bottomwear_img!=None:
206
  _, half_img, half_mask = start_tryon(imgs,topwear_img,topwear_des,"upper_body",is_checked,is_checked_crop,denoise_steps,seed)
207
+ IMG_data = [{"image": half_img}]
208
+ img_dataset = Dataset.from_dict(IMG_data)
209
+ return start_tryon(img_dataset,bottomwear_img,bottomwear_des,"lower_body",is_checked,is_checked_crop,denoise_steps,seed)
210
 
211
 
212
  garm_list = os.listdir(os.path.join(example_path,"cloth"))
 
226
  ##default human
227
 
228
 
229
+ image_blocks = gr.Blocks(theme=gr.themes.Ocean()).queue()
230
  with image_blocks as demo:
231
  gr.HTML("<center><h1>Virtual Try-On</h1></center>")
232
  gr.HTML("<center><p>Upload an image of a person and images of the clothes✨</p></center>")
 
269
 
270
 
271
  with gr.Column():
272
+ try_button = gr.Button(value="Try-on",variant='primary')
273
  with gr.Accordion(label="Advanced Settings", open=False):
274
  with gr.Row():
275
  denoise_steps = gr.Number(label="Denoising Steps", minimum=20, maximum=40, value=30, step=1)