nvn04 commited on
Commit
898979c
·
verified ·
1 Parent(s): 77ec430

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -62
app.py CHANGED
@@ -322,71 +322,68 @@ def app_gradio():
322
 
323
  # define root_path
324
  root_path = "resource/demo/example"
 
325
  # First column
326
  with gr.Column(scale=1, min_width=350):
327
  # Person image
328
- with gr.Row():
329
- with gr.Column(scale=1, min_width=230):
330
- image_path = gr.Image(
331
- type="filepath",
332
- interactive=True,
333
- visible=False,
334
- )
335
- person_image = gr.ImageEditor(
336
- interactive=True, label="Person Image", type="filepath"
337
- )
338
- # Mask instruction
339
- with gr.Row():
340
- with gr.Column(scale=1, min_width=230):
341
- gr.Markdown(
342
- '<span style="color: #808080; font-size: small;">Two ways to provide Mask:<br>1. Upload the person image and use the `🖌️` above to draw the Mask (higher priority)<br>2. Select the `Try-On Cloth Type` to generate automatically </span>'
343
- )
344
- cloth_type = gr.Radio(
345
- label="Try-On Cloth Type",
346
- choices=["upper", "lower", "overall"],
347
- value="upper",
348
- )
349
- # Model column examples
350
- with gr.Row():
351
- with gr.Column(scale=1, min_width=230):
352
- # Men examples
353
- men_exm = gr.Examples(
354
- examples=[
355
- os.path.join(root_path, "person", "men", _)
356
- for _ in os.listdir(os.path.join(root_path, "person", "men"))
357
- ],
358
- examples_per_page=4,
359
- inputs=image_path,
360
- label="Person Examples ①",
361
- )
362
- # Women examples
363
- women_exm = gr.Examples(
364
- examples=[
365
- os.path.join(root_path, "person", "women", _)
366
- for _ in os.listdir(os.path.join(root_path, "person", "women"))
367
- ],
368
- examples_per_page=4,
369
- inputs=image_path,
370
- label="Person Examples ",
371
- )
372
- # Markdown: component display text in Gradio
373
- gr.Markdown(
374
- '<span style="color: #808080; font-size: small;">*Person examples come from the demos of <a href="https://huggingface.co/spaces/levihsu/OOTDiffusion">OOTDiffusion</a> and <a href="https://www.outfitanyone.org">OutfitAnyone</a>. </span>'
375
- )
376
- # # Person pose example
377
- # condition_person_exm = gr.Examples(
378
- # examples=[
379
- # os.path.join(root_path, "condition", "person", _)
380
- # for _ in os.listdir(os.path.join(root_path, "condition", "person"))
381
- # ],
382
- # examples_per_page=4,
383
- # inputs=cloth_image,
384
- # label="Condition Reference Person Examples",
385
- # )
386
- # # Display text
387
- # gr.Markdown(
388
- # '<span style="color: #808080; font-size: small;">*Condition examples come from the Internet. </span>'
389
- # )
390
 
391
  # Second column
392
  with gr.Column(scale=1, min_width=350):
 
322
 
323
  # define root_path
324
  root_path = "resource/demo/example"
325
+
326
  # First column
327
  with gr.Column(scale=1, min_width=350):
328
  # Person image
329
+ image_path = gr.Image(
330
+ type="filepath",
331
+ interactive=True,
332
+ visible=False,
333
+ )
334
+ person_image = gr.ImageEditor(
335
+ interactive=True, label="Person Image", type="filepath"
336
+ )
337
+
338
+ # Mask instruction
339
+ gr.Markdown(
340
+ '<span style="color: #808080; font-size: small;">Two ways to provide Mask:<br>1. Upload the person image and use the `🖌️` above to draw the Mask (higher priority)<br>2. Select the `Try-On Cloth Type` to generate automatically </span>'
341
+ )
342
+ cloth_type = gr.Radio(
343
+ label="Try-On Cloth Type",
344
+ choices=["upper", "lower", "overall"],
345
+ value="upper",
346
+ )
347
+
348
+ # Model column examples
349
+ # Men examples
350
+ men_exm = gr.Examples(
351
+ examples=[
352
+ os.path.join(root_path, "person", "men", _)
353
+ for _ in os.listdir(os.path.join(root_path, "person", "men"))
354
+ ],
355
+ examples_per_page=4,
356
+ inputs=image_path,
357
+ label="Person Examples ",
358
+ )
359
+ # Women examples
360
+ women_exm = gr.Examples(
361
+ examples=[
362
+ os.path.join(root_path, "person", "women", _)
363
+ for _ in os.listdir(os.path.join(root_path, "person", "women"))
364
+ ],
365
+ examples_per_page=4,
366
+ inputs=image_path,
367
+ label="Person Examples ",
368
+ )
369
+ # Markdown: component display text in Gradio
370
+ gr.Markdown(
371
+ '<span style="color: #808080; font-size: small;">*Person examples come from the demos of <a href="https://huggingface.co/spaces/levihsu/OOTDiffusion">OOTDiffusion</a> and <a href="https://www.outfitanyone.org">OutfitAnyone</a>. </span>'
372
+ )
373
+ # # Person pose example
374
+ # condition_person_exm = gr.Examples(
375
+ # examples=[
376
+ # os.path.join(root_path, "condition", "person", _)
377
+ # for _ in os.listdir(os.path.join(root_path, "condition", "person"))
378
+ # ],
379
+ # examples_per_page=4,
380
+ # inputs=cloth_image,
381
+ # label="Condition Reference Person Examples",
382
+ # )
383
+ # # Display text
384
+ # gr.Markdown(
385
+ # '<span style="color: #808080; font-size: small;">*Condition examples come from the Internet. </span>'
386
+ # )
 
 
 
 
387
 
388
  # Second column
389
  with gr.Column(scale=1, min_width=350):