Update app.py
Browse files
app.py
CHANGED
@@ -491,6 +491,9 @@ def create_app():
|
|
491 |
with gr.Row():
|
492 |
with gr.Column(scale=1):
|
493 |
product_name = gr.Textbox(label="์ํ๋ช
(ํ๊ตญ์ด ์
๋ ฅ)", placeholder="์: ์คํจ์ผ์ด ํ๋ธ, ์ค๋งํธ์์น, ํฅ์, ์ด๋ํ ๋ฑ", interactive=True)
|
|
|
|
|
|
|
494 |
background_type = gr.Radio(
|
495 |
choices=["์ฌํ ๋ฐฐ๊ฒฝ", "์คํ๋์ค ๋ฐฐ๊ฒฝ", "์์ฐ ํ๊ฒฝ", "์ค๋ด ํ๊ฒฝ", "ํ
ํฌ๋๋ก์ง ๋ฐฐ๊ฒฝ", "์ปฌ๋ฌํ ํจํด ๋ฐฐ๊ฒฝ", "์ถ์/ํน์ ๋ฐฐ๊ฒฝ"],
|
496 |
label="๋ฐฐ๊ฒฝ ์ ํ",
|
@@ -566,32 +569,45 @@ def create_app():
|
|
566 |
inputs=[background_type],
|
567 |
outputs=[simple_dropdown, studio_dropdown, nature_dropdown, indoor_dropdown, tech_dropdown, colorful_dropdown, abstract_dropdown]
|
568 |
)
|
569 |
-
|
570 |
with gr.Row():
|
571 |
single_btn = gr.Button("ํ๋กฌํํธ ๋ฐ ๋จ์ผ ์ด๋ฏธ์ง ์์ฑ", variant="primary")
|
572 |
multi_btn = gr.Button("ํ๋กฌํํธ ๋ฐ 4์ฅ ์ด๋ฏธ์ง ์์ฑ", variant="primary")
|
|
|
573 |
with gr.Column(scale=1):
|
574 |
-
#
|
575 |
prompt_output = gr.Textbox(label="์์ฑ๋ ํ๋กฌํํธ (์์ด)", lines=6)
|
576 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
status_output = gr.Textbox(label="๊ฒฐ๊ณผ ์ ๋ณด", lines=3)
|
578 |
-
|
579 |
-
|
580 |
-
|
581 |
-
|
582 |
-
|
583 |
-
|
584 |
-
|
|
|
585 |
single_btn.click(
|
586 |
-
fn=
|
587 |
inputs=[image_input, background_type, simple_dropdown, studio_dropdown, nature_dropdown, indoor_dropdown, tech_dropdown, colorful_dropdown, abstract_dropdown, product_name, additional_info],
|
588 |
-
outputs=[
|
589 |
)
|
|
|
590 |
multi_btn.click(
|
591 |
fn=generate_product_images,
|
592 |
inputs=[image_input, background_type, simple_dropdown, studio_dropdown, nature_dropdown, indoor_dropdown, tech_dropdown, colorful_dropdown, abstract_dropdown, product_name, additional_info],
|
593 |
-
outputs=[image_output1, image_output2, image_output3, image_output4,
|
594 |
)
|
|
|
595 |
return demo
|
596 |
|
597 |
# ------------------- ๋ฉ์ธ ์คํ ํจ์ -------------------
|
|
|
491 |
with gr.Row():
|
492 |
with gr.Column(scale=1):
|
493 |
product_name = gr.Textbox(label="์ํ๋ช
(ํ๊ตญ์ด ์
๋ ฅ)", placeholder="์: ์คํจ์ผ์ด ํ๋ธ, ์ค๋งํธ์์น, ํฅ์, ์ด๋ํ ๋ฑ", interactive=True)
|
494 |
+
# ์ํ ์ด๋ฏธ์ง ์
๋ก๋๋ฅผ ์ํ๋ช
์๋๋ก ์ด๋
|
495 |
+
image_input = gr.Image(label="์ํ ์ด๋ฏธ์ง ์
๋ก๋", type="pil")
|
496 |
+
|
497 |
background_type = gr.Radio(
|
498 |
choices=["์ฌํ ๋ฐฐ๊ฒฝ", "์คํ๋์ค ๋ฐฐ๊ฒฝ", "์์ฐ ํ๊ฒฝ", "์ค๋ด ํ๊ฒฝ", "ํ
ํฌ๋๋ก์ง ๋ฐฐ๊ฒฝ", "์ปฌ๋ฌํ ํจํด ๋ฐฐ๊ฒฝ", "์ถ์/ํน์ ๋ฐฐ๊ฒฝ"],
|
499 |
label="๋ฐฐ๊ฒฝ ์ ํ",
|
|
|
569 |
inputs=[background_type],
|
570 |
outputs=[simple_dropdown, studio_dropdown, nature_dropdown, indoor_dropdown, tech_dropdown, colorful_dropdown, abstract_dropdown]
|
571 |
)
|
572 |
+
|
573 |
with gr.Row():
|
574 |
single_btn = gr.Button("ํ๋กฌํํธ ๋ฐ ๋จ์ผ ์ด๋ฏธ์ง ์์ฑ", variant="primary")
|
575 |
multi_btn = gr.Button("ํ๋กฌํํธ ๋ฐ 4์ฅ ์ด๋ฏธ์ง ์์ฑ", variant="primary")
|
576 |
+
|
577 |
with gr.Column(scale=1):
|
578 |
+
# ๊ณตํต ํ๋กฌํํธ ์ถ๋ ฅ ์์ญ
|
579 |
prompt_output = gr.Textbox(label="์์ฑ๋ ํ๋กฌํํธ (์์ด)", lines=6)
|
580 |
+
|
581 |
+
# ์ด๋ฏธ์ง ๋ ์ด์์ ๋ณ๊ฒฝ: 2x2 ๊ทธ๋ฆฌ๋๋ก ๋ฐฐ์น
|
582 |
+
with gr.Row():
|
583 |
+
image_output1 = gr.Image(label="์ด๋ฏธ์ง #1", type="filepath")
|
584 |
+
image_output2 = gr.Image(label="์ด๋ฏธ์ง #2", type="filepath")
|
585 |
+
|
586 |
+
with gr.Row():
|
587 |
+
image_output3 = gr.Image(label="์ด๋ฏธ์ง #3", type="filepath")
|
588 |
+
image_output4 = gr.Image(label="์ด๋ฏธ์ง #4", type="filepath")
|
589 |
+
|
590 |
status_output = gr.Textbox(label="๊ฒฐ๊ณผ ์ ๋ณด", lines=3)
|
591 |
+
|
592 |
+
# ๋จ์ผ ์ด๋ฏธ์ง ์์ฑ ํจ์ ์์
|
593 |
+
def modified_single_image_gen(*args):
|
594 |
+
# ๊ธฐ์กด ํจ์ ํธ์ถ
|
595 |
+
result_img, status, prompt = generate_product_image(*args)
|
596 |
+
# ๋จ์ผ ์ด๋ฏธ์ง๋ฅผ ์ฒซ ๋ฒ์งธ ์ด๋ฏธ์ง ์ฌ๋กฏ์ ๋ฐฐ์นํ๊ณ ๋๋จธ์ง๋ None์ผ๋ก ์ค์
|
597 |
+
return prompt, result_img, None, None, None, status
|
598 |
+
|
599 |
single_btn.click(
|
600 |
+
fn=modified_single_image_gen,
|
601 |
inputs=[image_input, background_type, simple_dropdown, studio_dropdown, nature_dropdown, indoor_dropdown, tech_dropdown, colorful_dropdown, abstract_dropdown, product_name, additional_info],
|
602 |
+
outputs=[prompt_output, image_output1, image_output2, image_output3, image_output4, status_output]
|
603 |
)
|
604 |
+
|
605 |
multi_btn.click(
|
606 |
fn=generate_product_images,
|
607 |
inputs=[image_input, background_type, simple_dropdown, studio_dropdown, nature_dropdown, indoor_dropdown, tech_dropdown, colorful_dropdown, abstract_dropdown, product_name, additional_info],
|
608 |
+
outputs=[image_output1, image_output2, image_output3, image_output4, status_output, prompt_output]
|
609 |
)
|
610 |
+
|
611 |
return demo
|
612 |
|
613 |
# ------------------- ๋ฉ์ธ ์คํ ํจ์ -------------------
|