Spaces:
Sleeping
Sleeping
Restore UI
Browse files
app.py
CHANGED
|
@@ -474,138 +474,27 @@ human_ex_list = human_list_path
|
|
| 474 |
|
| 475 |
image_blocks = gr.Blocks().queue()
|
| 476 |
with image_blocks as demo:
|
| 477 |
-
|
| 478 |
-
gr.HTML("""
|
| 479 |
-
<style>
|
| 480 |
-
/* ์ถ๋ ฅ ์ด๋ฏธ์ง ํฌ๊ธฐ ๊ณ ์ : Masked image output ๋ฐ Output */
|
| 481 |
-
/* PC: ๊ณ ์ ํฌ๊ธฐ (384x512) */
|
| 482 |
-
@media (min-width: 768px) {
|
| 483 |
-
#masked-img img,
|
| 484 |
-
#output-img img {
|
| 485 |
-
width: 384px !important;
|
| 486 |
-
height: 512px !important;
|
| 487 |
-
max-width: 384px !important;
|
| 488 |
-
max-height: 512px !important;
|
| 489 |
-
object-fit: contain !important;
|
| 490 |
-
}
|
| 491 |
-
#masked-img,
|
| 492 |
-
#output-img {
|
| 493 |
-
max-width: 384px !important;
|
| 494 |
-
}
|
| 495 |
-
}
|
| 496 |
-
|
| 497 |
-
/* ๋ชจ๋ฐ์ผ: ํ๋ฉด ํฌ๊ธฐ์ ๋ง๊ฒ ์ค์ผ์ผ๋งํ๋ ๋น์จ ์ ์ง (์ต๋ 384px) */
|
| 498 |
-
@media (max-width: 767px) {
|
| 499 |
-
#masked-img img,
|
| 500 |
-
#output-img img {
|
| 501 |
-
width: 100% !important;
|
| 502 |
-
max-width: 384px !important;
|
| 503 |
-
height: auto !important;
|
| 504 |
-
aspect-ratio: 3/4 !important;
|
| 505 |
-
object-fit: contain !important;
|
| 506 |
-
}
|
| 507 |
-
#masked-img,
|
| 508 |
-
#output-img {
|
| 509 |
-
width: 100% !important;
|
| 510 |
-
max-width: 384px !important;
|
| 511 |
-
}
|
| 512 |
-
}
|
| 513 |
-
|
| 514 |
-
/* ImageEditor: ์ด๋ฏธ์ง๋ง ํ๋ ์ ์์ ๋ง์ถ๊ธฐ (UI ์์๋ ๊ฑด๋๋ฆฌ์ง ์์) */
|
| 515 |
-
#image-editor-fixed canvas {
|
| 516 |
-
object-fit: contain !important;
|
| 517 |
-
}
|
| 518 |
-
#image-editor-fixed img {
|
| 519 |
-
object-fit: contain !important;
|
| 520 |
-
max-width: 100% !important;
|
| 521 |
-
max-height: 100% !important;
|
| 522 |
-
}
|
| 523 |
-
</style>
|
| 524 |
-
<script>
|
| 525 |
-
// ImageEditor์ canvas ์ค์ ํฝ์
ํฌ๊ธฐ๋ง ๊ณ ์ ํ์ฌ ๋ธ๋ฌ์ ์์น ์ ํ๋ ์ ์ง
|
| 526 |
-
// ํ๋ ์๊ณผ UI ์์๋ Gradio์ ๊ธฐ๋ณธ ๋์์ ๋งก๊น
|
| 527 |
-
(function() {
|
| 528 |
-
const CANVAS_WIDTH = 384;
|
| 529 |
-
const CANVAS_HEIGHT = 512;
|
| 530 |
-
|
| 531 |
-
function fixImageEditorCanvas() {
|
| 532 |
-
const editor = document.querySelector('#image-editor-fixed');
|
| 533 |
-
if (!editor) return;
|
| 534 |
-
|
| 535 |
-
// ImageEditor ๋ด๋ถ์ ๋ชจ๋ canvas ์ฐพ๊ธฐ
|
| 536 |
-
const canvases = editor.querySelectorAll('canvas');
|
| 537 |
-
canvases.forEach(function(canvas) {
|
| 538 |
-
// canvas์ ์ค์ ํฝ์
ํฌ๊ธฐ๋ ํญ์ ๊ณ ์ (๋ธ๋ฌ์ ์์น ์ ํ๋ ์ ์ง)
|
| 539 |
-
if (canvas.width !== CANVAS_WIDTH || canvas.height !== CANVAS_HEIGHT) {
|
| 540 |
-
canvas.width = CANVAS_WIDTH;
|
| 541 |
-
canvas.height = CANVAS_HEIGHT;
|
| 542 |
-
}
|
| 543 |
-
});
|
| 544 |
-
}
|
| 545 |
-
|
| 546 |
-
// ์ด๊ธฐ ์คํ
|
| 547 |
-
function init() {
|
| 548 |
-
fixImageEditorCanvas();
|
| 549 |
-
}
|
| 550 |
-
|
| 551 |
-
if (document.readyState === 'loading') {
|
| 552 |
-
document.addEventListener('DOMContentLoaded', init);
|
| 553 |
-
} else {
|
| 554 |
-
init();
|
| 555 |
-
}
|
| 556 |
-
|
| 557 |
-
// ์ด๋ฏธ์ง ๋ก๋ ํ ์ฌ์ ์ฉ
|
| 558 |
-
window.addEventListener('load', function() {
|
| 559 |
-
setTimeout(fixImageEditorCanvas, 100);
|
| 560 |
-
setTimeout(fixImageEditorCanvas, 500);
|
| 561 |
-
setTimeout(fixImageEditorCanvas, 1500);
|
| 562 |
-
});
|
| 563 |
-
|
| 564 |
-
// ๋ฆฌ์ฌ์ด์ฆ ์ ์ฌ์ ์ฉ (๋ชจ๋ฐ์ผ ํ์ ๋ฑ)
|
| 565 |
-
let resizeTimeout;
|
| 566 |
-
window.addEventListener('resize', function() {
|
| 567 |
-
clearTimeout(resizeTimeout);
|
| 568 |
-
resizeTimeout = setTimeout(fixImageEditorCanvas, 300);
|
| 569 |
-
});
|
| 570 |
-
|
| 571 |
-
// MutationObserver๋ก ๋์ ๋ณ๊ฒฝ ๊ฐ์ง (ImageEditor๊ฐ ๋์ ์ผ๋ก ๋ก๋๋ ๋)
|
| 572 |
-
const observer = new MutationObserver(function(mutations) {
|
| 573 |
-
fixImageEditorCanvas();
|
| 574 |
-
});
|
| 575 |
-
|
| 576 |
-
// ImageEditor๊ฐ ๋ก๋๋ ํ observer ์์
|
| 577 |
-
setTimeout(function() {
|
| 578 |
-
const editor = document.querySelector('#image-editor-fixed');
|
| 579 |
-
if (editor) {
|
| 580 |
-
observer.observe(editor, {
|
| 581 |
-
childList: true,
|
| 582 |
-
subtree: true,
|
| 583 |
-
attributes: false
|
| 584 |
-
});
|
| 585 |
-
}
|
| 586 |
-
}, 1000);
|
| 587 |
-
})();
|
| 588 |
-
</script>
|
| 589 |
-
""")
|
| 590 |
gr.Markdown("## DXCO : GENAI-VTON")
|
| 591 |
gr.Markdown("์์ฑ๋จ, ์ค์ง์, ์กฐ๋ฏผ์ฃผ based on IDM-VTON")
|
| 592 |
gr.Markdown("์ด๋ฏธ์ง๋ 3:4๋น์จ(384x512 ๋๋ 768x1024)๋ก ์ฌ๋ ค์ฃผ์ธ์")
|
| 593 |
with gr.Row():
|
| 594 |
with gr.Column():
|
| 595 |
-
imgs = gr.ImageEditor(sources='upload', type="pil", label='๋์ ์ด๋ฏธ์ง', interactive=True
|
| 596 |
-
img_url_input = gr.Textbox(label="๋์ ์ด๋ฏธ์ง URL", placeholder="์) https://example.com/human_image.jpg")
|
| 597 |
with gr.Row():
|
| 598 |
-
|
| 599 |
-
|
|
|
|
| 600 |
example = gr.Examples(
|
| 601 |
inputs=imgs,
|
| 602 |
-
examples_per_page=
|
| 603 |
-
examples=human_ex_list
|
| 604 |
)
|
| 605 |
|
| 606 |
with gr.Column():
|
| 607 |
garm_img = gr.Image(label="์์ ์ด๋ฏธ์ง", sources='upload', type="pil")
|
| 608 |
-
|
|
|
|
| 609 |
with gr.Row(elem_id="prompt-container"):
|
| 610 |
with gr.Row():
|
| 611 |
prompt = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
|
|
|
|
| 474 |
|
| 475 |
image_blocks = gr.Blocks().queue()
|
| 476 |
with image_blocks as demo:
|
| 477 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
gr.Markdown("## DXCO : GENAI-VTON")
|
| 479 |
gr.Markdown("์์ฑ๋จ, ์ค์ง์, ์กฐ๋ฏผ์ฃผ based on IDM-VTON")
|
| 480 |
gr.Markdown("์ด๋ฏธ์ง๋ 3:4๋น์จ(384x512 ๋๋ 768x1024)๋ก ์ฌ๋ ค์ฃผ์ธ์")
|
| 481 |
with gr.Row():
|
| 482 |
with gr.Column():
|
| 483 |
+
imgs = gr.ImageEditor(sources='upload', type="pil", label='๋์ ์ด๋ฏธ์ง', interactive=True)
|
|
|
|
| 484 |
with gr.Row():
|
| 485 |
+
img_url_input = gr.Textbox(label="๋์ ์ด๋ฏธ์ง URL", placeholder="์) https://example.com/human_image.jpg")
|
| 486 |
+
with gr.Row():
|
| 487 |
+
is_checked = gr.Checkbox(label="Yes", info="์๋ ๋ง์คํน",value=True)
|
| 488 |
example = gr.Examples(
|
| 489 |
inputs=imgs,
|
| 490 |
+
examples_per_page=10,
|
| 491 |
+
examples=human_ex_list
|
| 492 |
)
|
| 493 |
|
| 494 |
with gr.Column():
|
| 495 |
garm_img = gr.Image(label="์์ ์ด๋ฏธ์ง", sources='upload', type="pil")
|
| 496 |
+
with gr.Row():
|
| 497 |
+
garm_url_input = gr.Textbox(label="์์ ์ด๋ฏธ์ง URL", placeholder="์) https://example.com/garment.jpg")
|
| 498 |
with gr.Row(elem_id="prompt-container"):
|
| 499 |
with gr.Row():
|
| 500 |
prompt = gr.Textbox(placeholder="Description of garment ex) Short Sleeve Round Neck T-shirts", show_label=False, elem_id="prompt")
|