Spaces:
Build error
Build error
Simplify the UI
Browse files
app.py
CHANGED
@@ -316,7 +316,7 @@ HEADER = ""
|
|
316 |
def app_gradio():
|
317 |
with gr.Blocks(title="CatVTON") as demo:
|
318 |
gr.Markdown(HEADER)
|
319 |
-
with gr.Tab("
|
320 |
with gr.Row():
|
321 |
with gr.Column(scale=1, min_width=350):
|
322 |
with gr.Row():
|
@@ -332,7 +332,7 @@ def app_gradio():
|
|
332 |
with gr.Row():
|
333 |
with gr.Column(scale=1, min_width=230):
|
334 |
cloth_image = gr.Image(
|
335 |
-
interactive=True, label="
|
336 |
)
|
337 |
with gr.Column(scale=1, min_width=120):
|
338 |
gr.Markdown(
|
@@ -350,27 +350,32 @@ def app_gradio():
|
|
350 |
'<center><span style="color: #FF0000">!!! Click only Once, Wait for Delay !!!</span></center>'
|
351 |
)
|
352 |
|
353 |
-
gr.Markdown(
|
354 |
-
|
355 |
-
)
|
356 |
-
with gr.Accordion("Advanced Options", open=False):
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
374 |
with gr.Column(scale=2, min_width=500):
|
375 |
result_image = gr.Image(interactive=False, label="Result")
|
376 |
with gr.Row():
|
@@ -448,126 +453,126 @@ def app_gradio():
|
|
448 |
result_image,
|
449 |
)
|
450 |
|
451 |
-
with gr.Tab("Mask-based & Flux.1 Fill Dev"):
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
-
|
558 |
-
|
559 |
-
|
560 |
|
561 |
|
562 |
-
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
|
572 |
|
573 |
|
|
|
316 |
def app_gradio():
|
317 |
with gr.Blocks(title="CatVTON") as demo:
|
318 |
gr.Markdown(HEADER)
|
319 |
+
with gr.Tab("Virtual Try on"):
|
320 |
with gr.Row():
|
321 |
with gr.Column(scale=1, min_width=350):
|
322 |
with gr.Row():
|
|
|
332 |
with gr.Row():
|
333 |
with gr.Column(scale=1, min_width=230):
|
334 |
cloth_image = gr.Image(
|
335 |
+
interactive=True, label="Clothes Image", type="filepath"
|
336 |
)
|
337 |
with gr.Column(scale=1, min_width=120):
|
338 |
gr.Markdown(
|
|
|
350 |
'<center><span style="color: #FF0000">!!! Click only Once, Wait for Delay !!!</span></center>'
|
351 |
)
|
352 |
|
353 |
+
# gr.Markdown(
|
354 |
+
# '<span style="color: #808080; font-size: small;">Advanced options can adjust details:<br>1. `Inference Step` may enhance details;<br>2. `CFG` is highly correlated with saturation;<br>3. `Random seed` may improve pseudo-shadow.</span>'
|
355 |
+
# )
|
356 |
+
# with gr.Accordion("Advanced Options", open=False):
|
357 |
+
# num_inference_steps = gr.Slider(
|
358 |
+
# label="Inference Step", minimum=10, maximum=100, step=5, value=50
|
359 |
+
# )
|
360 |
+
# # Guidence Scale
|
361 |
+
# guidance_scale = gr.Slider(
|
362 |
+
# label="CFG Strenth", minimum=0.0, maximum=7.5, step=0.5, value=2.5
|
363 |
+
# )
|
364 |
+
# # Random Seed
|
365 |
+
# seed = gr.Slider(
|
366 |
+
# label="Seed", minimum=-1, maximum=10000, step=1, value=42
|
367 |
+
# )
|
368 |
+
# show_type = gr.Radio(
|
369 |
+
# label="Show Type",
|
370 |
+
# choices=["result only", "input & result", "input & mask & result"],
|
371 |
+
# value="input & mask & result",
|
372 |
+
# )
|
373 |
+
|
374 |
+
num_inference_steps = 50
|
375 |
+
guidance_scale = 2.5
|
376 |
+
seed = 42
|
377 |
+
show_type = "result only"
|
378 |
+
|
379 |
with gr.Column(scale=2, min_width=500):
|
380 |
result_image = gr.Image(interactive=False, label="Result")
|
381 |
with gr.Row():
|
|
|
453 |
result_image,
|
454 |
)
|
455 |
|
456 |
+
# with gr.Tab("Mask-based & Flux.1 Fill Dev"):
|
457 |
+
# with gr.Row():
|
458 |
+
# with gr.Column(scale=1, min_width=350):
|
459 |
+
# with gr.Row():
|
460 |
+
# image_path_flux = gr.Image(
|
461 |
+
# type="filepath",
|
462 |
+
# interactive=True,
|
463 |
+
# visible=False,
|
464 |
+
# )
|
465 |
+
# person_image_flux = gr.ImageEditor(
|
466 |
+
# interactive=True, label="Person Image", type="filepath"
|
467 |
+
# )
|
468 |
|
469 |
+
# with gr.Row():
|
470 |
+
# with gr.Column(scale=1, min_width=230):
|
471 |
+
# cloth_image_flux = gr.Image(
|
472 |
+
# interactive=True, label="Condition Image", type="filepath"
|
473 |
+
# )
|
474 |
+
# with gr.Column(scale=1, min_width=120):
|
475 |
+
# gr.Markdown(
|
476 |
+
# '<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>'
|
477 |
+
# )
|
478 |
+
# cloth_type = gr.Radio(
|
479 |
+
# label="Try-On Cloth Type",
|
480 |
+
# choices=["upper", "lower", "overall"],
|
481 |
+
# value="upper",
|
482 |
+
# )
|
483 |
+
|
484 |
+
# submit_flux = gr.Button("Submit")
|
485 |
+
# gr.Markdown(
|
486 |
+
# '<center><span style="color: #FF0000">!!! Click only Once, Wait for Delay !!!</span></center>'
|
487 |
+
# )
|
488 |
|
489 |
+
# with gr.Accordion("Advanced Options", open=False):
|
490 |
+
# num_inference_steps_flux = gr.Slider(
|
491 |
+
# label="Inference Step", minimum=10, maximum=100, step=5, value=50
|
492 |
+
# )
|
493 |
+
# # Guidence Scale
|
494 |
+
# guidance_scale_flux = gr.Slider(
|
495 |
+
# label="CFG Strenth", minimum=0.0, maximum=50, step=0.5, value=30
|
496 |
+
# )
|
497 |
+
# # Random Seed
|
498 |
+
# seed_flux = gr.Slider(
|
499 |
+
# label="Seed", minimum=-1, maximum=10000, step=1, value=42
|
500 |
+
# )
|
501 |
+
# show_type = gr.Radio(
|
502 |
+
# label="Show Type",
|
503 |
+
# choices=["result only", "input & result", "input & mask & result"],
|
504 |
+
# value="input & mask & result",
|
505 |
+
# )
|
506 |
|
507 |
+
# with gr.Column(scale=2, min_width=500):
|
508 |
+
# result_image_flux = gr.Image(interactive=False, label="Result")
|
509 |
+
# with gr.Row():
|
510 |
+
# # Photo Examples
|
511 |
+
# root_path = "resource/demo/example"
|
512 |
+
# with gr.Column():
|
513 |
+
# gr.Examples(
|
514 |
+
# examples=[
|
515 |
+
# os.path.join(root_path, "person", "men", _)
|
516 |
+
# for _ in os.listdir(os.path.join(root_path, "person", "men"))
|
517 |
+
# ],
|
518 |
+
# examples_per_page=4,
|
519 |
+
# inputs=image_path_flux,
|
520 |
+
# label="Person Examples ①",
|
521 |
+
# )
|
522 |
+
# gr.Examples(
|
523 |
+
# examples=[
|
524 |
+
# os.path.join(root_path, "person", "women", _)
|
525 |
+
# for _ in os.listdir(os.path.join(root_path, "person", "women"))
|
526 |
+
# ],
|
527 |
+
# examples_per_page=4,
|
528 |
+
# inputs=image_path_flux,
|
529 |
+
# label="Person Examples ②",
|
530 |
+
# )
|
531 |
+
# gr.Markdown(
|
532 |
+
# '<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>'
|
533 |
+
# )
|
534 |
+
# with gr.Column():
|
535 |
+
# gr.Examples(
|
536 |
+
# examples=[
|
537 |
+
# os.path.join(root_path, "condition", "upper", _)
|
538 |
+
# for _ in os.listdir(os.path.join(root_path, "condition", "upper"))
|
539 |
+
# ],
|
540 |
+
# examples_per_page=4,
|
541 |
+
# inputs=cloth_image_flux,
|
542 |
+
# label="Condition Upper Examples",
|
543 |
+
# )
|
544 |
+
# gr.Examples(
|
545 |
+
# examples=[
|
546 |
+
# os.path.join(root_path, "condition", "overall", _)
|
547 |
+
# for _ in os.listdir(os.path.join(root_path, "condition", "overall"))
|
548 |
+
# ],
|
549 |
+
# examples_per_page=4,
|
550 |
+
# inputs=cloth_image_flux,
|
551 |
+
# label="Condition Overall Examples",
|
552 |
+
# )
|
553 |
+
# condition_person_exm = gr.Examples(
|
554 |
+
# examples=[
|
555 |
+
# os.path.join(root_path, "condition", "person", _)
|
556 |
+
# for _ in os.listdir(os.path.join(root_path, "condition", "person"))
|
557 |
+
# ],
|
558 |
+
# examples_per_page=4,
|
559 |
+
# inputs=cloth_image_flux,
|
560 |
+
# label="Condition Reference Person Examples",
|
561 |
+
# )
|
562 |
+
# gr.Markdown(
|
563 |
+
# '<span style="color: #808080; font-size: small;">*Condition examples come from the Internet. </span>'
|
564 |
+
# )
|
565 |
|
566 |
|
567 |
+
# image_path_flux.change(
|
568 |
+
# person_example_fn, inputs=image_path_flux, outputs=person_image_flux
|
569 |
+
# )
|
570 |
+
|
571 |
+
# submit_flux.click(
|
572 |
+
# submit_function_flux,
|
573 |
+
# [person_image_flux, cloth_image_flux, cloth_type, num_inference_steps_flux, guidance_scale_flux, seed_flux, show_type],
|
574 |
+
# result_image_flux,
|
575 |
+
# )
|
576 |
|
577 |
|
578 |
|