Update app.py
Browse files
app.py
CHANGED
@@ -293,7 +293,12 @@ def generate_multiple_images(image1, image2, image3, prompt, progress=gr.Progres
|
|
293 |
return results[0], results[1], results[2], results[3], combined_status, combined_prompts
|
294 |
|
295 |
# Gradio ์ธํฐํ์ด์ค
|
296 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
|
297 |
gr.HTML(
|
298 |
"""
|
299 |
<div style="text-align: center; margin-bottom: 1rem;">
|
@@ -306,33 +311,39 @@ with gr.Blocks() as demo:
|
|
306 |
|
307 |
with gr.Row():
|
308 |
with gr.Column():
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
313 |
prompt_input = gr.Textbox(
|
314 |
lines=3,
|
315 |
placeholder="ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ๊ฑฐ๋ ๋น์๋๋ฉด ์๋ ํฉ์ฑ๋ฉ๋๋ค.",
|
316 |
label="ํ๋กฌํํธ (์ ํ ์ฌํญ)"
|
317 |
)
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
|
|
324 |
submit_btn = gr.Button("์ด๋ฏธ์ง ์์ฑ (4์ฅ)", variant="primary")
|
325 |
|
326 |
-
|
327 |
-
|
|
|
328 |
output_image1 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #1", height=300, width=300)
|
329 |
-
with gr.Column():
|
330 |
output_image2 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #2", height=300, width=300)
|
331 |
|
332 |
-
with gr.Row():
|
333 |
-
with gr.Column():
|
334 |
output_image3 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #3", height=300, width=300)
|
335 |
-
with gr.Column():
|
336 |
output_image4 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #4", height=300, width=300)
|
337 |
|
338 |
output_text = gr.Textbox(label="์ํ ๋ฉ์์ง")
|
@@ -340,17 +351,17 @@ with gr.Blocks() as demo:
|
|
340 |
|
341 |
# ์ ํ ์ต์
๋ฒํผ ํด๋ฆญ ์ ํ๋กฌํํธ ์
๋ ฅ๋ ์
๋ฐ์ดํธ (ํ๊ตญ์ด ๋ฌธ๊ตฌ)
|
342 |
image_change_btn.click(
|
343 |
-
fn=lambda: "#1
|
344 |
inputs=[],
|
345 |
outputs=prompt_input
|
346 |
)
|
347 |
text_remove_btn.click(
|
348 |
-
fn=lambda: "#1
|
349 |
inputs=[],
|
350 |
outputs=prompt_input
|
351 |
)
|
352 |
clothes_change_btn.click(
|
353 |
-
fn=lambda: "#1
|
354 |
inputs=[],
|
355 |
outputs=prompt_input
|
356 |
)
|
|
|
293 |
return results[0], results[1], results[2], results[3], combined_status, combined_prompts
|
294 |
|
295 |
# Gradio ์ธํฐํ์ด์ค
|
296 |
+
with gr.Blocks(css="""
|
297 |
+
.gradio-container {max-width: 650px; margin: 0 auto;}
|
298 |
+
.output-image {height: 300px; width: 300px;}
|
299 |
+
.input-image {height: 200px; width: 200px;}
|
300 |
+
.image-row {display: flex; justify-content: center;}
|
301 |
+
""") as demo:
|
302 |
gr.HTML(
|
303 |
"""
|
304 |
<div style="text-align: center; margin-bottom: 1rem;">
|
|
|
311 |
|
312 |
with gr.Row():
|
313 |
with gr.Column():
|
314 |
+
# ์
๋ ฅ ์ด๋ฏธ์ง UI๋ฅผ ๊ท ํ์๊ฒ ์ ๋ ฌ
|
315 |
+
with gr.Row(equal_height=True):
|
316 |
+
with gr.Column(scale=1, min_width=256):
|
317 |
+
image1_input = gr.Image(type="pil", label="#1", image_mode="RGB", height=256, width=256)
|
318 |
+
with gr.Column(scale=1, min_width=256):
|
319 |
+
image2_input = gr.Image(type="pil", label="#2", image_mode="RGB", height=256, width=256)
|
320 |
+
with gr.Column(scale=1, min_width=256):
|
321 |
+
image3_input = gr.Image(type="pil", label="#3", image_mode="RGB", height=256, width=256)
|
322 |
prompt_input = gr.Textbox(
|
323 |
lines=3,
|
324 |
placeholder="ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ๊ฑฐ๋ ๋น์๋๋ฉด ์๋ ํฉ์ฑ๋ฉ๋๋ค.",
|
325 |
label="ํ๋กฌํํธ (์ ํ ์ฌํญ)"
|
326 |
)
|
327 |
+
# ๋ฒํผ ๊ท ๋ฑ ๋ฐฐ์น
|
328 |
+
with gr.Row(equal_height=True, variant="panel"):
|
329 |
+
image_change_btn = gr.Button("์ด๋ฏธ์ง๋ณ๊ฒฝ", min_width=100, scale=1)
|
330 |
+
text_remove_btn = gr.Button("๊ธ์์ง์ฐ๊ธฐ", min_width=100, scale=1)
|
331 |
+
clothes_change_btn = gr.Button("๊ฐ์ ์ํ์ฐฉ์ฉ", min_width=100, scale=1)
|
332 |
+
background_change_btn = gr.Button("๋ฐฐ๊ฒฝ๋ฐ๊พธ๊ธฐ", min_width=100, scale=1)
|
333 |
+
composite_product_btn = gr.Button("๋ถ๋ถ์ง์ฐ๊ธฐ", min_width=100, scale=1)
|
334 |
submit_btn = gr.Button("์ด๋ฏธ์ง ์์ฑ (4์ฅ)", variant="primary")
|
335 |
|
336 |
+
# ์ถ๋ ฅ ์ด๋ฏธ์ง UI๋ฅผ 2x2 ๊ท ํ ๊ทธ๋ฆฌ๋๋ก ์ฌ๊ตฌ์ฑ
|
337 |
+
with gr.Row(equal_height=True):
|
338 |
+
with gr.Column(scale=1, min_width=300):
|
339 |
output_image1 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #1", height=300, width=300)
|
340 |
+
with gr.Column(scale=1, min_width=300):
|
341 |
output_image2 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #2", height=300, width=300)
|
342 |
|
343 |
+
with gr.Row(equal_height=True):
|
344 |
+
with gr.Column(scale=1, min_width=300):
|
345 |
output_image3 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #3", height=300, width=300)
|
346 |
+
with gr.Column(scale=1, min_width=300):
|
347 |
output_image4 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #4", height=300, width=300)
|
348 |
|
349 |
output_text = gr.Textbox(label="์ํ ๋ฉ์์ง")
|
|
|
351 |
|
352 |
# ์ ํ ์ต์
๋ฒํผ ํด๋ฆญ ์ ํ๋กฌํํธ ์
๋ ฅ๋ ์
๋ฐ์ดํธ (ํ๊ตญ์ด ๋ฌธ๊ตฌ)
|
353 |
image_change_btn.click(
|
354 |
+
fn=lambda: "(#1์ ์ฌ์ฑ)์ ์ด๋ฏธ์ง๋ฅผ ์ด์ง ๋ค๋ก ๋์๋ณด๋ ๋ชจ์ต์ผ๋ก ์ต๋ํ ์ด์ seed๋ฅผ ์ ์งํํ
์์ฐ์ค๋ฝ๊ฒ ๋ณ๊ฒฝํ๋ผ",
|
355 |
inputs=[],
|
356 |
outputs=prompt_input
|
357 |
)
|
358 |
text_remove_btn.click(
|
359 |
+
fn=lambda: "(#1 ์ด๋ฏธ์ง)์ ์๋ ์ค๊ตญ์ด๋ฅผ ๋ชจ๋ ์ ๊ฑฐํ๋ผ.",
|
360 |
inputs=[],
|
361 |
outputs=prompt_input
|
362 |
)
|
363 |
clothes_change_btn.click(
|
364 |
+
fn=lambda: "(#1์ ์ฌ์ฑ๋ชจ๊ฒ)์ด ์ ์ฒด ๋น์ก๊ณผ ํฌ์ฆ๋ ์ ์นํ ์ฒด (#2์ ์ ๊ธ๋ผ์ค)์ (#3์ ์ฒญ๋ฐ์ง)๋ฅผ ์ง์ ๋ชจ๋ธ์ด ์ฐฉ์ฉํ๊ฒ ์ฒ๋ผ ์์ฐ์ค๋ฝ๊ฒ ์ด๋ฏธ์ง๋ฅผ ์์ฑํ๋ผ.",
|
365 |
inputs=[],
|
366 |
outputs=prompt_input
|
367 |
)
|