Update app.py
Browse files
app.py
CHANGED
@@ -299,64 +299,78 @@ with gr.Blocks(css="""
|
|
299 |
.input-image {height: 200px; width: 200px;}
|
300 |
.image-row {display: flex; justify-content: center;}
|
301 |
""") as demo:
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
<
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
|
|
|
|
|
|
|
|
|
|
313 |
with gr.Column():
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
with gr.
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
)
|
|
|
299 |
.input-image {height: 200px; width: 200px;}
|
300 |
.image-row {display: flex; justify-content: center;}
|
301 |
""") as demo:
|
302 |
+
# ๋ฉ์ธ ์ปจํ
์ด๋ ์์
|
303 |
+
with gr.Column():
|
304 |
+
gr.HTML(
|
305 |
+
"""
|
306 |
+
<div style="text-align: center; margin-bottom: 1rem;">
|
307 |
+
<h1 style="margin-bottom: 0.5rem;">4์ฅ ์ด๋ฏธ์ง ์์ฑ๊ธฐ</h1>
|
308 |
+
<p style="margin-bottom: 0.2rem;">์ด๋ฏธ์ง๋ฅผ ์
๋ก๋ํ๊ณ "์ด๋ฏธ์ง ์์ฑ" ๋ฒํผ์ ํด๋ฆญํ๋ฉด</p>
|
309 |
+
<p>์ฐจ๋ก๋ก 4์ฅ์ ์ด๋ฏธ์ง๊ฐ ์์ฑ๋ฉ๋๋ค.</p>
|
310 |
+
</div>
|
311 |
+
"""
|
312 |
+
)
|
313 |
+
|
314 |
+
# ์
๋ ฅ ์น์
|
315 |
+
gr.HTML("<h3 style='text-align: center; margin-top: 1rem; margin-bottom: 0.5rem;'>์
๋ ฅ ์ด๋ฏธ์ง</h3>")
|
316 |
+
|
317 |
+
# ์
๋ ฅ ์ด๋ฏธ์ง UI๋ฅผ ์ ์ ํ ๊ฐ๊ฒฉ์ผ๋ก ์ธ๋ก ๋ฐฐ์น
|
318 |
with gr.Column():
|
319 |
+
with gr.Box():
|
320 |
+
image1_input = gr.Image(type="pil", label="#1", image_mode="RGB", height=200, width=200)
|
321 |
+
with gr.Box():
|
322 |
+
image2_input = gr.Image(type="pil", label="#2", image_mode="RGB", height=200, width=200)
|
323 |
+
with gr.Box():
|
324 |
+
image3_input = gr.Image(type="pil", label="#3", image_mode="RGB", height=200, width=200)
|
325 |
+
|
326 |
+
# ํ๋กฌํํธ ์
๋ ฅ
|
327 |
+
prompt_input = gr.Textbox(
|
328 |
+
lines=3,
|
329 |
+
placeholder="ํ๋กฌํํธ๋ฅผ ์
๋ ฅํ๊ฑฐ๋ ๋น์๋๋ฉด ์๋ ํฉ์ฑ๋ฉ๋๋ค.",
|
330 |
+
label="ํ๋กฌํํธ (์ ํ ์ฌํญ)"
|
331 |
+
)
|
332 |
+
|
333 |
+
# ๋ฒํผ ์คํ์ผ ๊ฐ์
|
334 |
+
with gr.Column(variant="panel"):
|
335 |
+
with gr.Row():
|
336 |
+
gr.HTML("<h4 style='margin-bottom: 0.5rem; text-align: center; width: 100%;'>์์
์ ํ</h4>")
|
337 |
+
with gr.Column():
|
338 |
+
image_change_btn = gr.Button("์ด๋ฏธ์ง๋ณ๊ฒฝ", scale=1, size="sm")
|
339 |
+
text_remove_btn = gr.Button("๊ธ์์ง์ฐ๊ธฐ", scale=1, size="sm")
|
340 |
+
clothes_change_btn = gr.Button("๊ฐ์ ์ํ์ฐฉ์ฉ", scale=1, size="sm")
|
341 |
+
background_change_btn = gr.Button("๋ฐฐ๊ฒฝ๋ฐ๊พธ๊ธฐ", scale=1, size="sm")
|
342 |
+
composite_product_btn = gr.Button("๋ถ๋ถ์ง์ฐ๊ธฐ", scale=1, size="sm")
|
343 |
+
|
344 |
+
# ์์ฑ ๋ฒํผ์ ๋ ๋์ ๋๊ฒ ๋ง๋ค๊ธฐ
|
345 |
+
with gr.Row(visible=True):
|
346 |
+
submit_btn = gr.Button("์ด๋ฏธ์ง ์์ฑ (4์ฅ)", variant="primary", scale=1, size="lg")
|
347 |
+
|
348 |
+
# ์ถ๋ ฅ ์น์
|
349 |
+
gr.HTML("<h3 style='text-align: center; margin-top: 1.5rem; margin-bottom: 0.5rem;'>์์ฑ๋ ์ด๋ฏธ์ง</h3>")
|
350 |
+
|
351 |
+
# ์ถ๋ ฅ ์ด๋ฏธ์ง UI๋ฅผ ์ธ๋ก๋ก ๋ฐฐ์น
|
352 |
+
with gr.Column():
|
353 |
+
with gr.Box():
|
354 |
+
output_image1 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #1", height=300, width=300)
|
355 |
+
with gr.Box():
|
356 |
+
output_image2 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #2", height=300, width=300)
|
357 |
+
with gr.Box():
|
358 |
+
output_image3 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #3", height=300, width=300)
|
359 |
+
with gr.Box():
|
360 |
+
output_image4 = gr.Image(label="์์ฑ๋ ์ด๋ฏธ์ง #4", height=300, width=300)
|
361 |
+
|
362 |
+
# ์ํ ๋ฐ ํ๋กฌํํธ ์ ๋ณด
|
363 |
+
output_text = gr.Textbox(label="์ํ ๋ฉ์์ง")
|
364 |
+
prompt_display = gr.Textbox(label="์ฌ์ฉ๋ ํ๋กฌํํธ (์์ด)", visible=True)
|
365 |
|
366 |
# ์ ํ ์ต์
๋ฒํผ ํด๋ฆญ ์ ํ๋กฌํํธ ์
๋ ฅ๋ ์
๋ฐ์ดํธ (ํ๊ตญ์ด ๋ฌธ๊ตฌ)
|
367 |
image_change_btn.click(
|
368 |
+
fn=lambda: "(#1์ ์ฌ์ฑ)์ ์ด๋ฏธ์ง๋ฅผ ์ด์ง ๋ค๋ก ๋์๋ณด๋ ๋ชจ์ต์ผ๋ก ์ต๋ํ ์ด์ seed๋ฅผ ์ ์งํํ
์์ฐ์ค๋ฝ๊ฒ ๋ณ๊ฒฝํ๋ผ.",
|
369 |
inputs=[],
|
370 |
outputs=prompt_input
|
371 |
)
|
372 |
text_remove_btn.click(
|
373 |
+
fn=lambda: "(#1 ์ด๋ฏธ์ง)์ ์๋ ์ค๊ตญ์ด๋ฅผ ๋ชจ๋ ์ ๊ฑฐํ๋ผ.,
|
374 |
inputs=[],
|
375 |
outputs=prompt_input
|
376 |
)
|