Kims12 commited on
Commit
63f219a
ยท
verified ยท
1 Parent(s): c18533a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +552 -163
app.py CHANGED
@@ -11,6 +11,7 @@ from google.genai import types
11
  from dotenv import load_dotenv
12
  load_dotenv()
13
 
 
14
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
15
  logger = logging.getLogger(__name__)
16
 
@@ -19,11 +20,7 @@ def save_binary_file(file_name, data):
19
  f.write(data)
20
 
21
  def translate_prompt_to_english(prompt):
22
- """
23
- ์ž…๋ ฅ๋œ ํ”„๋กฌํ”„ํŠธ์— ํ•œ๊ธ€์ด ํฌํ•จ๋˜์–ด ์žˆ์œผ๋ฉด Geminiโ€‘2.0โ€‘flash ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์˜์–ด๋กœ ๋ฒˆ์—ญํ•ฉ๋‹ˆ๋‹ค.
24
- ํ•œ๊ธ€์ด ์—†์œผ๋ฉด ์›๋ณธ ํ”„๋กฌํ”„ํŠธ๋ฅผ ๊ทธ๋Œ€๋กœ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
25
- ์ค‘์š”: #1, #2, #3 ํƒœ๊ทธ๋Š” ๋ฒˆ์—ญ ์ „ํ›„์— ๋ฐ˜๋“œ์‹œ ๋ณด์กด๋˜์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
26
- """
27
  if not re.search("[๊ฐ€-ํžฃ]", prompt):
28
  return prompt
29
 
@@ -88,9 +85,7 @@ def translate_prompt_to_english(prompt):
88
  return prompt
89
 
90
  def preprocess_prompt(prompt, image1, image2, image3):
91
- """
92
- ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ณ  ๊ธฐ๋Šฅ ๋ช…๋ น์„ ํ•ด์„
93
- """
94
  has_img1 = image1 is not None
95
  has_img2 = image2 is not None
96
  has_img3 = image3 is not None
@@ -139,10 +134,7 @@ def preprocess_prompt(prompt, image1, image2, image3):
139
  return prompt
140
 
141
  def generate_with_images(prompt, images, variation_index=0):
142
- """
143
- API ํ˜ธ์ถœ์„ ํ†ตํ•ด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ๊ฒฐ๊ณผ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
144
- variation_index๋กœ ๋‹ค์–‘ํ•œ ๋ณ€ํ™”๋ฅผ ์ค๋‹ˆ๋‹ค.
145
- """
146
  try:
147
  api_key = os.environ.get("GEMINI_API_KEY")
148
  if not api_key:
@@ -204,10 +196,7 @@ def generate_with_images(prompt, images, variation_index=0):
204
  return None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}"
205
 
206
  def process_images_with_prompt(image1, image2, image3, prompt, variation_index=0, max_retries=3):
207
- """
208
- 3๊ฐœ์˜ ์ด๋ฏธ์ง€์™€ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ฒ˜๋ฆฌํ•˜์—ฌ ์ตœ์ข… ์˜์–ด ํ”„๋กฌํ”„ํŠธ(final_prompt)๋ฅผ ์ƒ์„ฑํ•œ ํ›„,
209
- API๋ฅผ ํ˜ธ์ถœํ•˜์—ฌ ๊ฒฐ๊ณผ ์ด๋ฏธ์ง€๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค. ์—๋Ÿฌ ๋ฐœ์ƒ ์‹œ ์ตœ๋Œ€ max_retries ํšŸ์ˆ˜๋งŒํผ ์žฌ์‹œ๋„ํ•ฉ๋‹ˆ๋‹ค.
210
- """
211
  retry_count = 0
212
  last_error = None
213
 
@@ -252,9 +241,7 @@ def process_images_with_prompt(image1, image2, image3, prompt, variation_index=0
252
  return None, f"์ตœ๋Œ€ ์žฌ์‹œ๋„ ํšŸ์ˆ˜({max_retries}ํšŒ) ์ดˆ๊ณผ ํ›„ ์‹คํŒจ: {last_error}", prompt
253
 
254
  def generate_multiple_images(image1, image2, image3, prompt, progress=gr.Progress()):
255
- """
256
- ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์ด๋ฏธ์ง€๋ฅผ ์ฐจ๋ก€๋Œ€๋กœ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
257
- """
258
  results = []
259
  statuses = []
260
  prompts = []
@@ -289,12 +276,7 @@ def generate_multiple_images(image1, image2, image3, prompt, progress=gr.Progres
289
 
290
  return results[0], results[1], results[2], results[3], combined_status, combined_prompts
291
 
292
- # =====================================================================
293
- # ์•„๋ž˜๋Š” GFPGAN ์ฐธ์กฐ์ฝ”๋“œ๋ฅผ ํƒญ์œผ๋กœ ์ถ”๊ฐ€ํ•œ ๋ถ€๋ถ„ (๊ธฐ๋Šฅ ๊ตฌํ˜„ ๋ฐ UI ๊ฐœ์„ )
294
- # ๊ธฐ์กด GFPGAN ๊ด€๋ จ ์ฝ”๋“œ์—์„œ version๊ณผ Rescaling factor ๊ด€๋ จ UI๋Š” ์ œ๊ฑฐํ•˜๊ณ ,
295
- # GFPGANv1.4๋ฅผ ๊ณ ์ •์œผ๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
296
- # =====================================================================
297
-
298
  import sys
299
  from torchvision.transforms import functional
300
  sys.modules["torchvision.transforms.functional_tensor"] = functional
@@ -306,7 +288,7 @@ from realesrgan.utils import RealESRGANer
306
  import torch
307
  import cv2
308
 
309
- # ํ•„์š”ํ•œ ๋ชจ๋ธ ๋‹ค์šด๋กœ๋“œ (์ด๋ฏธ ์—†์œผ๋ฉด ๋‹ค์šด๋กœ๋“œ)
310
  if not os.path.exists('realesr-general-x4v3.pth'):
311
  os.system("wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth -P .")
312
  if not os.path.exists('GFPGANv1.4.pth'):
@@ -361,153 +343,560 @@ def upscaler(img, version, scale):
361
  print('์ „์ฒด ์˜ˆ์™ธ ๋ฐœ์ƒ:', error)
362
  return None
363
 
364
- # GFPGAN ์—…์Šค์ผ€์ผ๋Ÿฌ ํ•จ์ˆ˜ (๋ฒ„์ „๊ณผ ์Šค์ผ€์ผ์€ ๊ณ ์ •)
365
  def upscaler_korean(img):
366
  return upscaler(img, "GFPGANv1.4", 2)
367
 
368
- # =====================================================================
369
- # Gradio Blocks๋กœ ํƒญ UI ๊ตฌ์„ฑ (Gradio 5.21 ๊ธฐ์ค€)
370
- # =====================================================================
371
-
372
- with gr.Blocks() as demo:
373
- with gr.Tabs():
374
- with gr.TabItem("์ด์ปค๋จธ์Šค ์ด๋ฏธ์ง€ ์ƒ์„ฑ๊ธฐ"):
375
- gr.HTML(
376
- """
377
- <div style="text-align: center; margin-bottom: 1rem;">
378
- <h1>์ด์ปค๋จธ์Šค์šฉ ์ด๋ฏธ์ง€ ์ƒ์„ฑ๊ธฐ</h1>
379
- <p>์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•˜๊ณ  ์˜ˆ์ œ๋ฅผ ์ฐธ๊ฐ€ํ•˜์—ฌ ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ˆ˜์ •ํ•œ ํ›„ "์ด๋ฏธ์ง€ ์ƒ์„ฑ" ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์ฐจ๋ก€๋กœ 4์žฅ์˜ ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
380
  </div>
381
- """
382
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
 
384
- with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
385
  with gr.Column(scale=1):
386
- with gr.Row():
387
- image1_input = gr.Image(type="pil", label="#1", image_mode="RGB", height=300, width=200)
388
- image2_input = gr.Image(type="pil", label="#2", image_mode="RGB", height=300, width=200)
389
- image3_input = gr.Image(type="pil", label="#3", image_mode="RGB", height=300, width=200)
390
- prompt_input = gr.Textbox(
391
- lines=3,
392
- placeholder="ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜ ๋น„์›Œ๋‘๋ฉด ์ž๋™ ํ•ฉ์„ฑ๋ฉ๋‹ˆ๋‹ค.",
393
- label="ํ”„๋กฌํ”„ํŠธ (์„ ํƒ ์‚ฌํ•ญ)"
394
- )
395
- with gr.Row():
396
- image_change_btn1 = gr.Button("์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ-1")
397
- image_change_btn2 = gr.Button("์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ-2")
398
- text_remove_btn = gr.Button("๊ธ€์ž ์ง€์šฐ๊ธฐ")
399
- text_change_btn = gr.Button("๊ธ€์ž ๋ณ€๊ฒฝํ•˜๊ธฐ")
400
- clothes_change_btn1 = gr.Button("๊ฐ€์ƒ ์ƒํ’ˆ์ฐฉ์šฉ-1")
401
- clothes_change_btn2 = gr.Button("๊ฐ€์ƒ ์ƒํ’ˆ์ฐฉ์šฉ-2")
402
- holding_product_btn = gr.Button("์ƒํ’ˆ๋“ค๊ณ  ์žˆ๊ธฐ")
403
- background_change_btn = gr.Button("๋ฐฐ๊ฒฝ ๋ฐ”๊พธ๊ธฐ")
404
- composite_product_btn = gr.Button("๋ถ€๋ถ„ ์ง€์šฐ๊ธฐ")
405
- submit_btn = gr.Button("์ด๋ฏธ์ง€ ์ƒ์„ฑ (4์žฅ)", variant="primary")
406
-
407
- gr.Markdown(
408
- """
409
- ### ์‚ฌ์šฉ ๋ฐฉ๋ฒ•:
410
 
411
- 1. **์ž๋™ ํ•ฉ์„ฑ**: ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•˜๊ณ  ํ”„๋กฌํ”„ํŠธ๋ฅผ ๋น„์›Œ๋‘๋ฉด ์ž๋™์œผ๋กœ ํ•ฉ์„ฑ๋ฉ๋‹ˆ๋‹ค.
412
- 2. **์ด๋ฏธ์ง€ ์ฐธ์กฐ**: #1, #2, #3์œผ๋กœ ๊ฐ ์ด๋ฏธ์ง€๋ฅผ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
413
- 3. **์„ ํƒ ์˜ต์…˜**: ์œ„์˜ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ๋ž€์— ํ•œ๊ตญ์–ด ๋ฌธ๊ตฌ๋กœ ์ž…๋ ฅํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.
414
- 4. **๋‹ค์–‘ํ•œ ์ด๋ฏธ์ง€**: "์ด๋ฏธ์ง€ ์ƒ์„ฑ" ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ์ฐจ๋ก€๋กœ 4์žฅ์˜ ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
415
- 5. **์˜ˆ์ œ ์„ ํƒ**: ๋‹ค์–‘ํ•œ ์˜ˆ์ œ๋ฅผ ํ†ตํ•ด ๋ฏธ๋ฆฌ ํ…Œ์ŠคํŠธํ•ด๋ณด์„ธ์š”.
 
 
416
 
417
- > **ํŒ**: ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ง์ ‘ ์ˆ˜์ •ํ•  ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
418
- """
419
- )
420
-
421
- gr.Markdown("## ์˜ˆ์ œ ์ด๋ฏธ์ง€")
422
- examples = [
423
- ["down/๋ชจ๋ธ.jpg", None, None, "(#1์˜ ์—ฌ์„ฑ)์ด ์‚ด์ง ๋’ค๋กœ ๋Œ์•„๋ณด๋Š” ๋ชจ์Šต์œผ๋กœ ์ตœ๋Œ€ํ•œ ์ด์ „ seed๋ฅผ ์œ ์ง€ํ•œํ…Œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ณ€๊ฒฝํ•˜๋ผ."],
424
- ["down/์ƒ์–ด๋ ˆ๊ณ ๋ชจํ˜•.png", None, None, "(#1 ๋ ˆ๋ชจ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋งŒ ๊ฒ€์€์ƒ‰ ๊ณ ๋ž˜๋ ˆ๊ณ ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋‚˜๋จธ์ง€ ๋ถ€๋ถ„์€ seed๋ฅผ ๋ณ€๊ฒฝ์„ ํ•˜์ง€๋งˆ๋ผ."],
425
- ["down/์ค‘๊ตญ์–ด.png", None, None, "(#1 ์ด๋ฏธ์ง€)์— ์žˆ๋Š” ์ค‘๊ตญ์–ด๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋ผ."],
426
- ["down/ํ…์ŠคํŠธ.webp", None, None, '(#1์˜ ํ…์ŠคํŠธ)๋ฅผ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•œ์ฒด ํ…์ŠคํŠธ๋งŒ "Hello"๋กœ ๋ฐ”๊ฟ”๋ผ'],
427
- ["down/๋ชจ๋ธ.jpg", "down/์„ ๊ธ€๋ผ์Šค.png", "down/์ฒญ๋ฐ”์ง€.png", "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์™€ (#3์˜ ์ฒญ๋ฐ”์ง€)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ๊ฒƒ ์ฒ˜๋Ÿผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
428
- ["down/๋ชจ๋ธ.jpg", "down/์„ ๊ธ€๋ผ์Šค.png", "down/์นดํŽ˜์ „๊ฒฝ.png", "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ ๊ฒƒ์ฒ˜๋Ÿผ (#3์˜ ์žฅ์†Œ)์—์„œ ์˜์ž์— ์•‰์•„ ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
429
- ["down/๋ชจ๋ธ.jpg", "down/์™€์ธ์ž”.png", None, "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์™€์ธ์ž”)์„ ์—ฌ์„ฑ๋ชจ๋ธ์ด ํ™๋ณดํ•  ์™€์ธ์ž”์„ ๋‹๋ณด์ด๊ฒŒ ๋“ค๊ณ  ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ๋ชจ์Šต์œผ๋กœ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
430
- ["down/๋ชจ๋ธ.jpg", "down/์นดํŽ˜์ „๊ฒฝ.png", None, "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2 ์ด๋ฏธ์ง€์˜ ๋ฐฐ๊ฒฝ)์„ ์ฃผ์š” ํ”ผ์‚ฌ์ฒด๋Š” ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜์—ฌ ์ด๋ฏธ์ง€์˜ ๋ถ„์œ„๊ธฐ๊ฐ€ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ƒ์„ฑํ•˜๋ผ."],
431
- ["down/์ƒ์–ด๋ ˆ๊ณ ๋ชจํ˜•.png", None, None, "(#1์˜ ๋ ˆ๊ณ ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋ฅผ ์ œ๊ฑฐํ•œ ํ›„, ๊ทธ ์ž๋ฆฌ๋ฅผ ์ฃผ๋ณ€ ๋ฐฐ๊ฒฝ๊ณผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ฑ„์›Œ์ฃผ์„ธ์š”. ๋‹จ, ์ด๋ฏธ์ง€์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์˜ ์ฃผ์š” ์š”์†Œ๋Š” ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•ด ํ•ด์•ผํ•œ๋‹ค."]
432
- ]
433
-
434
- gr.Examples(
435
- examples=examples,
436
- inputs=[image1_input, image2_input, image3_input, prompt_input],
437
- elem_id="examples-grid"
438
- )
439
-
440
  with gr.Column(scale=1):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  with gr.Row():
442
  with gr.Column():
443
- output_image1 = gr.Image(label="์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€ #1", height=600, width=450)
444
- output_image3 = gr.Image(label="์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€ #3", height=600, width=450)
 
445
  with gr.Column():
446
- output_image2 = gr.Image(label="์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€ #2", height=600, width=450)
447
- output_image4 = gr.Image(label="์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€ #4", height=600, width=450)
448
 
449
- output_text = gr.Textbox(label="์ƒํƒœ ๋ฉ”์‹œ์ง€", lines=4)
450
- prompt_display = gr.Textbox(label="์‚ฌ์šฉ๋œ ํ”„๋กฌํ”„ํŠธ (์˜์–ด)", visible=True, lines=4)
451
-
452
- image_change_btn1.click(
453
- fn=lambda: "(#1์˜ ์—ฌ์„ฑ)์ด ์‚ด์ง ๋’ค๋กœ ๋Œ์•„๋ณด๋Š” ๋ชจ์Šต์œผ๋กœ ์ตœ๋Œ€ํ•œ ์ด์ „ seed๋ฅผ ์œ ์ง€ํ•œํ…Œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ณ€๊ฒฝํ•˜๋ผ.",
454
- inputs=[],
455
- outputs=prompt_input
456
- )
457
- image_change_btn2.click(
458
- fn=lambda: "(#1 ๋ ˆ๋ชจ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋งŒ ๊ฒ€์€์ƒ‰ ๊ณ ๋ž˜๋ ˆ๊ณ ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋‚˜๋จธ์ง€ ๋ถ€๋ถ„์€ seed๋ฅผ ๋ณ€๊ฒฝ์„ ํ•˜์ง€๋งˆ๋ผ.",
459
- inputs=[],
460
- outputs=prompt_input
461
- )
462
- text_remove_btn.click(
463
- fn=lambda: "(#1 ์ด๋ฏธ์ง€)์— ์žˆ๋Š” ์ค‘๊ตญ์–ด๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋ผ.",
464
- inputs=[],
465
- outputs=prompt_input
466
- )
467
- text_change_btn.click(
468
- fn=lambda: '(#1์˜ ํ…์ŠคํŠธ)๋ฅผ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•œ์ฒด ํ…์ŠคํŠธ๋งŒ "Hello"๋กœ ๋ฐ”๊ฟ”๋ผ',
469
- inputs=[],
470
- outputs=prompt_input
471
- )
472
- clothes_change_btn1.click(
473
- fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๊ฒ”)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์™€ (#3์˜ ์ฒญ๋ฐ”์ง€)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ๊ฒƒ ์ฒ˜๋Ÿผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ.",
474
- inputs=[],
475
- outputs=prompt_input
476
- )
477
- clothes_change_btn2.click(
478
- fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ ๊ฒƒ์ฒ˜๋Ÿผ (#3์˜ ์žฅ์†Œ)์—์„œ ์˜์ž์— ์•‰์•„ ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ.",
479
- inputs=[],
480
- outputs=prompt_input
481
- )
482
- holding_product_btn.click(
483
- fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์™€์ธ์ž”)์„ ์—ฌ์„ฑ๋ชจ๋ธ์ด ํ™๋ณดํ•  ์™€์ธ์ž”์„ ๋‹๋ณด์ด๊ฒŒ ๋“ค๊ณ  ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ๋ชจ์Šต์œผ๋กœ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ.",
484
- inputs=[],
485
- outputs=prompt_input
486
- )
487
- background_change_btn.click(
488
- fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2 ์ด๋ฏธ์ง€์˜ ๋ฐฐ๊ฒฝ)์„ ์ฃผ์š” ํ”ผ์‚ฌ์ฒด๋Š” ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜์—ฌ ๋‘ ์ด๋ฏธ์ง€์˜ ๋ถ„์œ„๊ธฐ๊ฐ€ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ƒ์„ฑํ•˜๋ผ.",
489
- inputs=[],
490
- outputs=prompt_input
491
- )
492
- composite_product_btn.click(
493
- fn=lambda: "(#1์˜ ๋ ˆ๊ณ ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋ฅผ ์ œ๊ฑฐํ•œ ํ›„, ๊ทธ ์ž๋ฆฌ๋ฅผ ์ฃผ๋ณ€ ๋ฐฐ๊ฒฝ๊ณผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ฑ„์›Œ์ฃผ์„ธ์š”. ๋‹จ, ์ด๋ฏธ์ง€์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์˜ ์ฃผ์š” ์š”์†Œ๋Š” ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•ด ํ•ด์•ผํ•œ๋‹ค.",
494
- inputs=[],
495
- outputs=prompt_input
496
- )
497
- submit_btn.click(
498
- fn=generate_multiple_images,
499
- inputs=[image1_input, image2_input, image3_input, prompt_input],
500
- outputs=[output_image1, output_image2, output_image3, output_image4, output_text, prompt_display],
501
- )
502
-
503
- with gr.TabItem("GFPGAN ์—…์Šค์ผ€์ผ๋Ÿฌ"):
504
- gr.Markdown("<h1 style='text-align: center;'>GFPGAN ์—…์Šค์ผ€์ผ๋Ÿฌ ๋ฐ ๋ณต์›</h1>")
505
- gr.Markdown("์ž…๋ ฅ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•˜๋ฉด GFPGANv1.4 ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์–ผ๊ตด ๋ณต์› ๋ฐ ์—…์Šค์ผ€์ผ๋ง์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.")
506
- with gr.Row():
507
- gfpgan_input = gr.Image(type="filepath", label="์ž…๋ ฅ ์ด๋ฏธ์ง€", image_mode="RGB")
508
- gfpgan_output = gr.Image(type="numpy", label="์ถœ๋ ฅ ์ด๋ฏธ์ง€")
509
- gfpgan_btn = gr.Button("์—…์Šค์ผ€์ผ ๋ฐ ๋ณต์›")
510
- gfpgan_btn.click(fn=upscaler_korean, inputs=gfpgan_input, outputs=gfpgan_output)
511
-
512
- demo.queue()
513
- demo.launch()
 
11
  from dotenv import load_dotenv
12
  load_dotenv()
13
 
14
+ # ๊ธฐ์กด ์ฝ”๋“œ ์œ ์ง€ (๋กœ๊น…, ํ•จ์ˆ˜ ๋“ฑ ๋ชจ๋“  ๊ธฐ๋Šฅ ์ฝ”๋“œ)
15
  logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
16
  logger = logging.getLogger(__name__)
17
 
 
20
  f.write(data)
21
 
22
  def translate_prompt_to_english(prompt):
23
+ # ๊ธฐ์กด ํ•จ์ˆ˜ ์œ ์ง€
 
 
 
 
24
  if not re.search("[๊ฐ€-ํžฃ]", prompt):
25
  return prompt
26
 
 
85
  return prompt
86
 
87
  def preprocess_prompt(prompt, image1, image2, image3):
88
+ # ๊ธฐ์กด ํ•จ์ˆ˜ ์œ ์ง€
 
 
89
  has_img1 = image1 is not None
90
  has_img2 = image2 is not None
91
  has_img3 = image3 is not None
 
134
  return prompt
135
 
136
  def generate_with_images(prompt, images, variation_index=0):
137
+ # ๊ธฐ์กด ํ•จ์ˆ˜ ์œ ์ง€
 
 
 
138
  try:
139
  api_key = os.environ.get("GEMINI_API_KEY")
140
  if not api_key:
 
196
  return None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}"
197
 
198
  def process_images_with_prompt(image1, image2, image3, prompt, variation_index=0, max_retries=3):
199
+ # ๊ธฐ์กด ํ•จ์ˆ˜ ์œ ์ง€
 
 
 
200
  retry_count = 0
201
  last_error = None
202
 
 
241
  return None, f"์ตœ๋Œ€ ์žฌ์‹œ๋„ ํšŸ์ˆ˜({max_retries}ํšŒ) ์ดˆ๊ณผ ํ›„ ์‹คํŒจ: {last_error}", prompt
242
 
243
  def generate_multiple_images(image1, image2, image3, prompt, progress=gr.Progress()):
244
+ # ๊ธฐ์กด ํ•จ์ˆ˜ ์œ ์ง€
 
 
245
  results = []
246
  statuses = []
247
  prompts = []
 
276
 
277
  return results[0], results[1], results[2], results[3], combined_status, combined_prompts
278
 
279
+ # GFPGAN ๊ด€๋ จ ์ฝ”๋“œ ์œ ์ง€
 
 
 
 
 
280
  import sys
281
  from torchvision.transforms import functional
282
  sys.modules["torchvision.transforms.functional_tensor"] = functional
 
288
  import torch
289
  import cv2
290
 
291
+ # ํ•„์š”ํ•œ ๋ชจ๋ธ ๋‹ค์šด๋กœ๋“œ
292
  if not os.path.exists('realesr-general-x4v3.pth'):
293
  os.system("wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.5.0/realesr-general-x4v3.pth -P .")
294
  if not os.path.exists('GFPGANv1.4.pth'):
 
343
  print('์ „์ฒด ์˜ˆ์™ธ ๋ฐœ์ƒ:', error)
344
  return None
345
 
 
346
  def upscaler_korean(img):
347
  return upscaler(img, "GFPGANv1.4", 2)
348
 
349
+ # ์ปค์Šคํ…€ CSS ์Šคํƒ€์ผ
350
+ custom_css = """
351
+ :root {
352
+ --primary-color: #5561e9;
353
+ --secondary-color: #6c8aff;
354
+ --accent-color: #ff6b6b;
355
+ --background-color: #f0f5ff;
356
+ --card-bg: #ffffff;
357
+ --text-color: #334155;
358
+ --border-radius: 18px;
359
+ --shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
360
+ }
361
+
362
+ body {
363
+ font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
364
+ background-color: var(--background-color);
365
+ color: var(--text-color);
366
+ line-height: 1.6;
367
+ }
368
+
369
+ /* Gradio ์ปจํ…Œ์ด๋„ˆ ์˜ค๋ฒ„๋ผ์ด๋“œ */
370
+ .gradio-container {
371
+ max-width: 100% !important;
372
+ margin: 0 auto !important;
373
+ padding: 0 !important;
374
+ background-color: var(--background-color) !important;
375
+ }
376
+
377
+ /* ์ƒ๋‹จ ํ—ค๋” */
378
+ .app-header {
379
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
380
+ color: white;
381
+ padding: 2rem;
382
+ border-radius: var(--border-radius);
383
+ margin-bottom: 1.5rem;
384
+ box-shadow: var(--shadow);
385
+ text-align: center;
386
+ }
387
+
388
+ .app-header h1 {
389
+ margin: 0;
390
+ font-size: 2.5rem;
391
+ font-weight: 700;
392
+ letter-spacing: -0.5px;
393
+ }
394
+
395
+ .app-header p {
396
+ margin: 0.75rem 0 0;
397
+ font-size: 1.1rem;
398
+ opacity: 0.9;
399
+ }
400
+
401
+ /* ํŒจ๋„ ์Šคํƒ€์ผ๋ง */
402
+ .panel {
403
+ background-color: var(--card-bg);
404
+ border-radius: var(--border-radius);
405
+ box-shadow: var(--shadow);
406
+ padding: 1.5rem;
407
+ margin-bottom: 1.5rem;
408
+ border: 1px solid rgba(0, 0, 0, 0.04);
409
+ transition: transform 0.3s ease;
410
+ }
411
+
412
+ .panel:hover {
413
+ transform: translateY(-5px);
414
+ }
415
+
416
+ /* ์„น์…˜ ์ œ๋ชฉ */
417
+ .section-title {
418
+ font-size: 1.5rem;
419
+ font-weight: 700;
420
+ color: var(--primary-color);
421
+ margin-bottom: 1rem;
422
+ padding-bottom: 0.5rem;
423
+ border-bottom: 2px solid var(--secondary-color);
424
+ display: flex;
425
+ align-items: center;
426
+ }
427
+
428
+ .section-title i {
429
+ margin-right: 0.5rem;
430
+ font-size: 1.4rem;
431
+ }
432
+
433
+ /* ๋ฒ„ํŠผ ์Šคํƒ€์ผ๋ง */
434
+ .custom-button {
435
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
436
+ color: white !important;
437
+ border: none !important;
438
+ border-radius: calc(var(--border-radius) - 5px) !important;
439
+ padding: 0.8rem 1.2rem !important;
440
+ font-weight: 600 !important;
441
+ cursor: pointer !important;
442
+ transition: all 0.3s ease !important;
443
+ box-shadow: 0 4px 6px rgba(50, 50, 93, 0.11), 0 1px 3px rgba(0, 0, 0, 0.08);
444
+ text-transform: none !important;
445
+ display: flex !important;
446
+ align-items: center !important;
447
+ justify-content: center !important;
448
+ }
449
+
450
+ .custom-button:hover {
451
+ transform: translateY(-2px) !important;
452
+ box-shadow: 0 7px 14px rgba(50, 50, 93, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08) !important;
453
+ }
454
+
455
+ .custom-button.primary {
456
+ background: linear-gradient(135deg, var(--accent-color), #ff9a8b) !important;
457
+ }
458
+
459
+ .custom-button i {
460
+ margin-right: 0.5rem;
461
+ }
462
+
463
+ /* ์ด๋ฏธ์ง€ ์ปจํ…Œ์ด๋„ˆ */
464
+ .image-container {
465
+ border-radius: var(--border-radius);
466
+ overflow: hidden;
467
+ border: 1px solid rgba(0, 0, 0, 0.08);
468
+ transition: all 0.3s ease;
469
+ background-color: white;
470
+ }
471
+
472
+ .image-container:hover {
473
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
474
+ }
475
+
476
+ /* ํƒญ ์ปจํ…Œ์ด๋„ˆ */
477
+ .custom-tabs {
478
+ background-color: transparent !important;
479
+ border: none !important;
480
+ margin-bottom: 1rem;
481
+ }
482
+
483
+ .custom-tabs button {
484
+ background-color: rgba(255, 255, 255, 0.7) !important;
485
+ border: none !important;
486
+ border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
487
+ padding: 0.8rem 1.5rem !important;
488
+ font-weight: 600 !important;
489
+ color: var(--text-color) !important;
490
+ transition: all 0.3s ease !important;
491
+ }
492
+
493
+ .custom-tabs button[aria-selected="true"] {
494
+ background-color: var(--primary-color) !important;
495
+ color: white !important;
496
+ }
497
+
498
+ /* ์ž…๋ ฅ ํ•„๋“œ */
499
+ .custom-input {
500
+ border-radius: calc(var(--border-radius) - 5px) !important;
501
+ border: 1px solid rgba(0, 0, 0, 0.1) !important;
502
+ padding: 0.8rem 1rem !important;
503
+ transition: all 0.3s ease !important;
504
+ }
505
+
506
+ .custom-input:focus {
507
+ border-color: var(--primary-color) !important;
508
+ box-shadow: 0 0 0 2px rgba(85, 97, 233, 0.2) !important;
509
+ }
510
+
511
+ /* ์‚ฌ์šฉ์ž ๋งค๋‰ด์–ผ */
512
+ .user-manual {
513
+ background-color: white;
514
+ padding: 2rem;
515
+ border-radius: var(--border-radius);
516
+ box-shadow: var(--shadow);
517
+ margin-top: 2rem;
518
+ }
519
+
520
+ .manual-title {
521
+ font-size: 1.8rem;
522
+ font-weight: 700;
523
+ color: var(--primary-color);
524
+ margin-bottom: 1.5rem;
525
+ text-align: center;
526
+ display: flex;
527
+ align-items: center;
528
+ justify-content: center;
529
+ }
530
+
531
+ .manual-title i {
532
+ margin-right: 0.5rem;
533
+ font-size: 1.8rem;
534
+ }
535
+
536
+ .manual-section {
537
+ margin-bottom: 1.5rem;
538
+ padding: 1.2rem;
539
+ background-color: #f8faff;
540
+ border-radius: calc(var(--border-radius) - 5px);
541
+ }
542
+
543
+ .manual-section-title {
544
+ font-size: 1.3rem;
545
+ font-weight: 700;
546
+ margin-bottom: 1rem;
547
+ color: var(--primary-color);
548
+ display: flex;
549
+ align-items: center;
550
+ }
551
+
552
+ .manual-section-title i {
553
+ margin-right: 0.5rem;
554
+ font-size: 1.2rem;
555
+ }
556
+
557
+ .manual-text {
558
+ font-size: 1rem;
559
+ line-height: 1.7;
560
+ }
561
+
562
+ .manual-text strong {
563
+ color: var(--accent-color);
564
+ }
565
+
566
+ .tip-box {
567
+ background-color: rgba(255, 107, 107, 0.1);
568
+ border-left: 3px solid var(--accent-color);
569
+ padding: 1rem 1.2rem;
570
+ margin: 1rem 0;
571
+ border-radius: 8px;
572
+ }
573
+
574
+ /* ๋ฒ„ํŠผ ๊ทธ๋ฃน */
575
+ .button-grid {
576
+ display: grid;
577
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
578
+ gap: 0.8rem;
579
+ margin-bottom: 1.2rem;
580
+ }
581
+
582
+ /* ๋กœ๋”ฉ ์• ๋‹ˆ๋ฉ”์ด์…˜ */
583
+ .progress-container {
584
+ background-color: rgba(255, 255, 255, 0.9);
585
+ border-radius: var(--border-radius);
586
+ padding: 2rem;
587
+ box-shadow: var(--shadow);
588
+ text-align: center;
589
+ }
590
+
591
+ .progress-bar {
592
+ height: 8px;
593
+ border-radius: 4px;
594
+ background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
595
+ margin: 1rem 0;
596
+ }
597
+
598
+ /* ์˜ˆ์‹œ ๊ทธ๋ฆฌ๋“œ */
599
+ .examples-grid {
600
+ display: grid;
601
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
602
+ gap: 1rem;
603
+ margin: 1.5rem 0;
604
+ }
605
+
606
+ .example-card {
607
+ background: white;
608
+ border-radius: var(--border-radius);
609
+ overflow: hidden;
610
+ box-shadow: var(--shadow);
611
+ transition: transform 0.3s ease;
612
+ }
613
+
614
+ .example-card:hover {
615
+ transform: translateY(-5px);
616
+ }
617
+
618
+ /* ๋ฐ˜์‘ํ˜• */
619
+ @media (max-width: 768px) {
620
+ .button-grid {
621
+ grid-template-columns: repeat(2, 1fr);
622
+ }
623
+ }
624
+
625
+ /* ์ „์ฒด ์ธํ„ฐํŽ˜์ด์Šค ๋‘ฅ๊ทผ ๋ชจ์„œ๋ฆฌ */
626
+ .block, .prose, .gr-prose, .gr-form, .gr-panel {
627
+ border-radius: var(--border-radius) !important;
628
+ }
629
+
630
+ /* ๋ฉ”์ธ ์ปจํ…์ธ  ์Šคํฌ๋กค๋ฐ” */
631
+ ::-webkit-scrollbar {
632
+ width: 8px;
633
+ height: 8px;
634
+ }
635
+
636
+ ::-webkit-scrollbar-track {
637
+ background: rgba(0, 0, 0, 0.05);
638
+ border-radius: 10px;
639
+ }
640
+
641
+ ::-webkit-scrollbar-thumb {
642
+ background: var(--secondary-color);
643
+ border-radius: 10px;
644
+ }
645
+ """
646
+
647
+ # FontAwesome ์•„์ด์ฝ˜ ํฌํ•จ
648
+ fontawesome_link = """
649
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
650
+ """
651
+
652
+ # ์•ฑ ํ—ค๋” HTML
653
+ header_html = """
654
+ <div class="app-header">
655
+ <h1>โœจ ์ด์ปค๋จธ์Šค ์ด๋ฏธ์ง€ ๋งˆ๋ฒ•์‚ฌ โœจ</h1>
656
+ <p>์‰ฝ๊ณ  ๋น ๋ฅด๊ฒŒ ์ƒํ’ˆ ์ด๋ฏธ์ง€๋ฅผ ํŽธ์ง‘ํ•˜๊ณ  ์ƒ์„ฑํ•˜์„ธ์š”! ํ•œ ๋ฒˆ์˜ ํด๋ฆญ์œผ๋กœ ์ „๋ฌธ์ ์ธ ์ด๋ฏธ์ง€๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.</p>
657
+ </div>
658
+ """
659
+
660
+ # ์‚ฌ์šฉ์ž ๋งค๋‰ด์–ผ HTML
661
+ user_manual_html = """
662
+ <div class="user-manual">
663
+ <div class="manual-title"><i class="fas fa-book"></i> ์‚ฌ์šฉ ์„ค๋ช…์„œ</div>
664
+
665
+ <div class="manual-section">
666
+ <div class="manual-section-title"><i class="fas fa-magic"></i> ๊ธฐ๋ณธ ์‚ฌ์šฉ๋ฒ•</div>
667
+ <p class="manual-text">
668
+ <span style="font-size: 1.1rem; font-weight: 600; color: #5561e9;">1๏ธโƒฃ ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ</span><br>
669
+ ์ตœ๋Œ€ 3๊ฐœ์˜ ์ด๋ฏธ์ง€๋ฅผ ์—…๋กœ๋“œํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€๋Š” ํ•„์ˆ˜์ž…๋‹ˆ๋‹ค.<br><br>
670
+
671
+ <span style="font-size: 1.1rem; font-weight: 600; color: #5561e9;">2๏ธโƒฃ ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ ๋˜๋Š” ๋ฒ„ํŠผ ์„ ํƒ</span><br>
672
+ ๋ณ€ํ™˜ํ•˜๊ณ  ์‹ถ์€ ๋‚ด์šฉ์„ ์ง์ ‘ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜, ๋ฏธ๋ฆฌ ์ •์˜๋œ ๋ฒ„ํŠผ ์ค‘ ํ•˜๋‚˜๋ฅผ ์„ ํƒํ•˜์„ธ์š”.<br><br>
673
+
674
+ <span style="font-size: 1.1rem; font-weight: 600; color: #5561e9;">3๏ธโƒฃ ์ด๋ฏธ์ง€ ์ƒ์„ฑ</span><br>
675
+ '์ด๋ฏธ์ง€ ์ƒ์„ฑ' ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด 4๊ฐ€์ง€ ๋ฒ„์ „์˜ ์ด๋ฏธ์ง€๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
676
+ </p>
677
+ </div>
678
+
679
+ <div class="manual-section">
680
+ <div class="manual-section-title"><i class="fas fa-hashtag"></i> ์ด๋ฏธ์ง€ ์ฐธ์กฐ ๋ฐฉ๋ฒ•</div>
681
+ <p class="manual-text">
682
+ ํ”„๋กฌํ”„ํŠธ์—์„œ ๋‹ค์Œ ํƒœ๊ทธ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ๊ฐ ์ด๋ฏธ์ง€๋ฅผ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค:
683
+ <ul>
684
+ <li><strong style="font-size: 1.05rem;">#1</strong> - ์ฒซ ๋ฒˆ์งธ ์ด๋ฏธ์ง€</li>
685
+ <li><strong style="font-size: 1.05rem;">#2</strong> - ๋‘ ๋ฒˆ์งธ ์ด๋ฏธ์ง€</li>
686
+ <li><strong style="font-size: 1.05rem;">#3</strong> - ์„ธ ๋ฒˆ์งธ ์ด๋ฏธ์ง€</li>
687
+ </ul>
688
+
689
+ <div class="tip-box">
690
+ <i class="fas fa-lightbulb"></i> <strong>ํŒ:</strong> ์˜ˆ๋ฅผ ๋“ค์–ด, "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2์˜ ์„ ๊ธ€๋ผ์Šค)๋ฅผ ์ฐฉ์šฉํ•œ ๋ชจ์Šต"๊ณผ ๊ฐ™์ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
691
+ </div>
692
+ </p>
693
+ </div>
694
+
695
+ <div class="manual-section">
696
+ <div class="manual-section-title"><i class="fas fa-tools"></i> ์ฃผ์š” ๊ธฐ๋Šฅ</div>
697
+ <div class="manual-text">
698
+ <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem;">
699
+ <div>
700
+ <p style="font-size: 1.1rem; font-weight: 600; color: #ff6b6b;"><i class="fas fa-exchange-alt"></i> ์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ</p>
701
+ ํฌ์ฆˆ๋‚˜ ์Šคํƒ€์ผ์„ ๋ณ€๊ฒฝํ•˜๋ฉด์„œ ์›๋ณธ์˜ ์ฃผ์š” ์š”์†Œ๋Š” ์œ ์ง€ํ•ฉ๋‹ˆ๋‹ค.
702
  </div>
703
+
704
+ <div>
705
+ <p style="font-size: 1.1rem; font-weight: 600; color: #ff6b6b;"><i class="fas fa-eraser"></i> ๊ธ€์ž ์ง€์šฐ๊ธฐ/๋ณ€๊ฒฝ</p>
706
+ ์ด๋ฏธ์ง€์˜ ํ…์ŠคํŠธ๋ฅผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ œ๊ฑฐํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ํ…์ŠคํŠธ๋กœ ๋ณ€๊ฒฝํ•ฉ๋‹ˆ๋‹ค.
707
+ </div>
708
+
709
+ <div>
710
+ <p style="font-size: 1.1rem; font-weight: 600; color: #ff6b6b;"><i class="fas fa-tshirt"></i> ๊ฐ€์ƒ ์ƒํ’ˆ์ฐฉ์šฉ</p>
711
+ ๋ชจ๋ธ์—๊ฒŒ ๋‹ค๋ฅธ ์ด๋ฏธ์ง€์˜ ์ƒํ’ˆ์„ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ฐฉ์šฉ์‹œํ‚ต๋‹ˆ๋‹ค.
712
+ </div>
713
+
714
+ <div>
715
+ <p style="font-size: 1.1rem; font-weight: 600; color: #ff6b6b;"><i class="fas fa-image"></i> ๋ฐฐ๊ฒฝ ๋ฐ”๊พธ๊ธฐ</p>
716
+ ์ฃผ์š” ํ”ผ์‚ฌ์ฒด๋Š” ์œ ์ง€ํ•˜๋ฉฐ ๋ฐฐ๊ฒฝ๋งŒ ๊ต์ฒดํ•ฉ๋‹ˆ๋‹ค.
717
+ </div>
718
+ </div>
719
+ </div>
720
+ </div>
721
+
722
+ <div class="manual-section">
723
+ <div class="manual-section-title"><i class="fas fa-search-plus"></i> GFPGAN ์—…์Šค์ผ€์ผ๋Ÿฌ</div>
724
+ <p class="manual-text">
725
+ <span style="font-size: 1.1rem; font-weight: 600; color: #5561e9;">์ด๋ฏธ์ง€ ๊ฐœ์„  ๊ธฐ๋Šฅ</span><br>
726
+ ์ €ํ•ด์ƒ๋„ ์ด๋ฏธ์ง€๋ฅผ ๊ณ ํ•ด์ƒ๋„๋กœ ๋ณ€ํ™˜ํ•˜๊ณ , ์–ผ๊ตด์„ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค.<br>
727
+ ํŠนํžˆ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ฒฝ์šฐ์— ํšจ๊ณผ์ ์ž…๋‹ˆ๋‹ค:
728
+ <ul>
729
+ <li>ํ•ด์ƒ๋„๊ฐ€ ๋‚ฎ์€ ์ด๋ฏธ์ง€ ๊ฐœ์„ </li>
730
+ <li>ํ๋ฆฟํ•˜๊ฑฐ๋‚˜ ๋…ธ์ด์ฆˆ๊ฐ€ ์žˆ๋Š” ์–ผ๊ตด ๋ณต์›</li>
731
+ <li>์ด๋ฏธ์ง€ ์ „๋ฐ˜์ ์ธ ์„ ๋ช…๋„ ํ–ฅ์ƒ</li>
732
+ </ul>
733
 
734
+ <div class="tip-box">
735
+ <i class="fas fa-lightbulb"></i> <strong>ํŒ:</strong> ์ด๋ฏธ์ง€์˜ ํฌ๊ธฐ๊ฐ€ ์ž‘์„์ˆ˜๋ก ์ฒ˜๋ฆฌ ์†๋„๊ฐ€ ๋น ๋ฆ…๋‹ˆ๋‹ค. ์–ผ๊ตด์ด ํฌํ•จ๋œ ์ด๋ฏธ์ง€์—์„œ ๊ฐ€์žฅ ์ข‹์€ ๊ฒฐ๊ณผ๋ฅผ ์–ป์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
736
+ </div>
737
+ </p>
738
+ </div>
739
+ </div>
740
+ """
741
+
742
+ # UI ๊ตฌ์„ฑ
743
+ with gr.Blocks(css=custom_css) as demo:
744
+ gr.HTML(fontawesome_link)
745
+ gr.HTML(header_html)
746
+
747
+ with gr.Tabs(elem_classes="custom-tabs") as tabs:
748
+ with gr.TabItem("โœจ ์ด์ปค๋จธ์Šค ์ด๋ฏธ์ง€ ์ƒ์„ฑ๊ธฐ", elem_classes="tab-content"):
749
+ with gr.Row(equal_height=True):
750
  with gr.Column(scale=1):
751
+ with gr.Box(elem_classes="panel"):
752
+ gr.HTML('<div class="section-title"><i class="fas fa-upload"></i> ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ</div>')
753
+ with gr.Row():
754
+ image1_input = gr.Image(type="pil", label="#1", image_mode="RGB", elem_classes="image-container", height=220)
755
+ image2_input = gr.Image(type="pil", label="#2", image_mode="RGB", elem_classes="image-container", height=220)
756
+ image3_input = gr.Image(type="pil", label="#3", image_mode="RGB", elem_classes="image-container", height=220)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
757
 
758
+ gr.HTML('<div class="section-title"><i class="fas fa-keyboard"></i> ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ</div>')
759
+ prompt_input = gr.Textbox(
760
+ lines=3,
761
+ placeholder="ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜ ๋น„์›Œ๋‘๋ฉด ์ž๋™ ํ•ฉ์„ฑ๋ฉ๋‹ˆ๋‹ค. '#1', '#2', '#3'์œผ๋กœ ๊ฐ ์ด๋ฏธ์ง€๋ฅผ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.",
762
+ label="ํ”„๋กฌํ”„ํŠธ (์„ ํƒ ์‚ฌํ•ญ)",
763
+ elem_classes="custom-input"
764
+ )
765
 
766
+ gr.HTML('<div class="section-title"><i class="fas fa-sliders-h"></i> ๋ณ€ํ™˜ ์˜ต์…˜</div>')
767
+ with gr.Column(elem_classes="button-grid"):
768
+ image_change_btn1 = gr.Button('<i class="fas fa-sync-alt"></i> ์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ-1', elem_classes="custom-button")
769
+ image_change_btn2 = gr.Button('<i class="fas fa-sync-alt"></i> ์ด๋ฏธ์ง€ ๋ณ€๊ฒฝ-2', elem_classes="custom-button")
770
+ text_remove_btn = gr.Button('<i class="fas fa-eraser"></i> ๊ธ€์ž ์ง€์šฐ๊ธฐ', elem_classes="custom-button")
771
+ text_change_btn = gr.Button('<i class="fas fa-font"></i> ๊ธ€์ž ๋ณ€๊ฒฝ', elem_classes="custom-button")
772
+ clothes_change_btn1 = gr.Button('<i class="fas fa-tshirt"></i> ์ƒํ’ˆ์ฐฉ์šฉ-1', elem_classes="custom-button")
773
+ clothes_change_btn2 = gr.Button('<i class="fas fa-glasses"></i> ์ƒํ’ˆ์ฐฉ์šฉ-2', elem_classes="custom-button")
774
+ holding_product_btn = gr.Button('<i class="fas fa-wine-glass"></i> ์ƒํ’ˆ๋“ค๊ณ  ์žˆ๊ธฐ', elem_classes="custom-button")
775
+ background_change_btn = gr.Button('<i class="fas fa-image"></i> ๋ฐฐ๊ฒฝ ๋ฐ”๊พธ๊ธฐ', elem_classes="custom-button")
776
+ composite_product_btn = gr.Button('<i class="fas fa-cut"></i> ๋ถ€๋ถ„ ์ง€์šฐ๊ธฐ', elem_classes="custom-button")
777
+
778
+ submit_btn = gr.Button('<i class="fas fa-magic"></i> ์ด๋ฏธ์ง€ ์ƒ์„ฑ (4์žฅ)', elem_classes="custom-button primary")
779
+
 
 
 
 
 
 
 
 
 
780
  with gr.Column(scale=1):
781
+ with gr.Box(elem_classes="panel"):
782
+ gr.HTML('<div class="section-title"><i class="fas fa-images"></i> ์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€</div>')
783
+ with gr.Row():
784
+ with gr.Column():
785
+ output_image1 = gr.Image(label="์ด๋ฏธ์ง€ #1", elem_classes="image-container")
786
+ output_image3 = gr.Image(label="์ด๋ฏธ์ง€ #3", elem_classes="image-container")
787
+ with gr.Column():
788
+ output_image2 = gr.Image(label="์ด๋ฏธ์ง€ #2", elem_classes="image-container")
789
+ output_image4 = gr.Image(label="์ด๋ฏธ์ง€ #4", elem_classes="image-container")
790
+
791
+ gr.HTML('<div class="section-title"><i class="fas fa-info-circle"></i> ๊ฒฐ๊ณผ ์ •๋ณด</div>')
792
+ output_text = gr.Textbox(label="์ƒํƒœ ๋ฉ”์‹œ์ง€", lines=2, elem_classes="custom-input")
793
+ prompt_display = gr.Textbox(label="์‚ฌ์šฉ๋œ ํ”„๋กฌํ”„ํŠธ (์˜์–ด)", visible=True, lines=2, elem_classes="custom-input")
794
+
795
+ gr.HTML('<div class="section-title"><i class="fas fa-lightbulb"></i> ์˜ˆ์ œ ์ด๋ฏธ์ง€</div>')
796
+ with gr.Box(elem_classes="panel"):
797
+ examples = [
798
+ ["down/๋ชจ๋ธ.jpg", None, None, "(#1์˜ ์—ฌ์„ฑ)์ด ์‚ด์ง ๋’ค๋กœ ๋Œ์•„๋ณด๋Š” ๋ชจ์Šต์œผ๋กœ ์ตœ๋Œ€ํ•œ ์ด์ „ seed๋ฅผ ์œ ์ง€ํ•œํ…Œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ณ€๊ฒฝํ•˜๋ผ."],
799
+ ["down/์ƒ์–ด๋ ˆ๊ณ ๋ชจํ˜•.png", None, None, "(#1 ๋ ˆ๋ชจ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋งŒ ๊ฒ€์€์ƒ‰ ๊ณ ๋ž˜๋ ˆ๊ณ ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋‚˜๋จธ์ง€ ๋ถ€๋ถ„์€ seed๋ฅผ ๋ณ€๊ฒฝ์„ ํ•˜์ง€๋งˆ๋ผ."],
800
+ ["down/์ค‘๊ตญ์–ด.png", None, None, "(#1 ์ด๋ฏธ์ง€)์— ์žˆ๋Š” ์ค‘๊ตญ์–ด๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋ผ."],
801
+ ["down/ํ…์ŠคํŠธ.webp", None, None, '(#1์˜ ํ…์ŠคํŠธ)๋ฅผ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•œ์ฒด ํ…์ŠคํŠธ๋งŒ "Hello"๋กœ ๋ฐ”๊ฟ”๋ผ'],
802
+ ["down/๋ชจ๋ธ.jpg", "down/์„ ๊ธ€๋ผ์Šค.png", "down/์ฒญ๋ฐ”์ง€.png", "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์™€ (#3์˜ ์ฒญ๋ฐ”์ง€)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ๊ฒƒ ์ฒ˜๋Ÿผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
803
+ ["down/๋ชจ๋ธ.jpg", "down/์„ ๊ธ€๋ผ์Šค.png", "down/์นดํŽ˜์ „๊ฒฝ.png", "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ ๊ฒƒ์ฒ˜๋Ÿผ (#3์˜ ์žฅ์†Œ)์—์„œ ์˜์ž์— ์•‰์•„ ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
804
+ ["down/๋ชจ๋ธ.jpg", "down/์™€์ธ์ž”.png", None, "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์™€์ธ์ž”)์„ ์—ฌ์„ฑ๋ชจ๋ธ์ด ํ™๋ณดํ•  ์™€์ธ์ž”์„ ๋‹๋ณด์ด๊ฒŒ ๋“ค๊ณ  ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ๋ชจ์Šต์œผ๋กœ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
805
+ ["down/๋ชจ๋ธ.jpg", "down/์นดํŽ˜์ „๊ฒฝ.png", None, "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2 ์ด๋ฏธ์ง€์˜ ๋ฐฐ๊ฒฝ)์„ ์ฃผ์š” ํ”ผ์‚ฌ์ฒด๋Š” ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜์—ฌ ์ด๋ฏธ์ง€์˜ ๋ถ„์œ„๊ธฐ๊ฐ€ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ƒ์„ฑํ•˜๋ผ."],
806
+ ["down/์ƒ์–ด๋ ˆ๊ณ ๋ชจํ˜•.png", None, None, "(#1์˜ ๋ ˆ๊ณ ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋ฅผ ์ œ๊ฑฐํ•œ ํ›„, ๊ทธ ์ž๋ฆฌ๋ฅผ ์ฃผ๋ณ€ ๋ฐฐ๊ฒฝ๊ณผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ฑ„์›Œ์ฃผ์„ธ์š”. ๋‹จ, ์ด๋ฏธ์ง€์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์˜ ์ฃผ์š” ์š”์†Œ๋Š” ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•ด ํ•ด์•ผํ•œ๋‹ค."]
807
+ ]
808
+
809
+ gr.Examples(
810
+ examples=examples,
811
+ inputs=[image1_input, image2_input, image3_input, prompt_input],
812
+ elem_id="examples-grid",
813
+ elem_classes="examples-grid"
814
+ )
815
+
816
+ # ์‚ฌ์šฉ์ž ๋งค๋‰ด์–ผ
817
+ gr.HTML(user_manual_html)
818
+
819
+ with gr.TabItem("๐Ÿ” GFPGAN ์—…์Šค์ผ€์ผ๋Ÿฌ", elem_classes="tab-content"):
820
+ with gr.Row():
821
+ with gr.Column(elem_classes="panel"):
822
+ gr.HTML('<div class="section-title"><i class="fas fa-search-plus"></i> ์ด๋ฏธ์ง€ ์—…์Šค์ผ€์ผ & ๋ณต์›</div>')
823
+ gr.HTML("""
824
+ <p style="margin-bottom: 1rem; font-size: 1.05rem;">
825
+ GFPGANv1.4 ๋ชจ๋ธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ด๋ฏธ์ง€๋ฅผ ๊ณ ํ•ด์ƒ๋„๋กœ ๋ณ€ํ™˜ํ•˜๊ณ  ์–ผ๊ตด์„ ๋ณต์›ํ•ฉ๋‹ˆ๋‹ค.
826
+ </p>
827
+ <div class="tip-box">
828
+ <i class="fas fa-lightbulb"></i> <strong>ํŒ:</strong> ํ•ด์ƒ๋„๊ฐ€ ๋‚ฎ๊ฑฐ๋‚˜ ํ’ˆ์งˆ์ด ๋–จ์–ด์ง€๋Š” ์ด๋ฏธ์ง€, ํŠนํžˆ ์–ผ๊ตด ์ด๋ฏธ์ง€์— ํšจ๊ณผ์ ์ž…๋‹ˆ๋‹ค.
829
+ </div>
830
+ """)
831
+
832
  with gr.Row():
833
  with gr.Column():
834
+ gr.HTML('<div class="section-title"><i class="fas fa-upload"></i> ์ž…๋ ฅ ์ด๋ฏธ์ง€</div>')
835
+ gfpgan_input = gr.Image(type="filepath", label="์—…๋กœ๋“œ", elem_classes="image-container")
836
+
837
  with gr.Column():
838
+ gr.HTML('<div class="section-title"><i class="fas fa-download"></i> ๊ฒฐ๊ณผ ์ด๋ฏธ์ง€</div>')
839
+ gfpgan_output = gr.Image(type="numpy", label="์—…์Šค์ผ€์ผ ๊ฒฐ๊ณผ", elem_classes="image-container")
840
 
841
+ gfpgan_btn = gr.Button('<i class="fas fa-magic"></i> ์—…์Šค์ผ€์ผ ๋ฐ ๋ณต์›', elem_classes="custom-button primary")
842
+
843
+ # ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ์—ฐ๊ฒฐ
844
+ image_change_btn1.click(
845
+ fn=lambda: "(#1์˜ ์—ฌ์„ฑ)์ด ์‚ด์ง ๋’ค๋กœ ๋Œ์•„๋ณด๋Š” ๋ชจ์Šต์œผ๋กœ ์ตœ๋Œ€ํ•œ ์ด์ „ seed๋ฅผ ์œ ์ง€ํ•œํ…Œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ณ€๊ฒฝํ•˜๋ผ.",
846
+ inputs=[],
847
+ outputs=prompt_input
848
+ )
849
+ image_change_btn2.click(
850
+ fn=lambda: "(#1 ๋ ˆ๋ชจ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋งŒ ๊ฒ€์€์ƒ‰ ๊ณ ๋ž˜๋ ˆ๊ณ ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋‚˜๋จธ์ง€ ๋ถ€๋ถ„์€ seed๋ฅผ ๋ณ€๊ฒฝ์„ ํ•˜์ง€๋งˆ๋ผ.",
851
+ inputs=[],
852
+ outputs=prompt_input
853
+ )
854
+ text_remove_btn.click(
855
+ fn=lambda: "(#1 ์ด๋ฏธ์ง€)์— ์žˆ๋Š” ์ค‘๊ตญ์–ด๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋ผ.",
856
+ inputs=[],
857
+ outputs=prompt_input
858
+ )
859
+ text_change_btn.click(
860
+ fn=lambda: '(#1์˜ ํ…์ŠคํŠธ)๋ฅผ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•œ์ฒด ํ…์ŠคํŠธ๋งŒ "Hello"๋กœ ๋ฐ”๊ฟ”๋ผ',
861
+ inputs=[],
862
+ outputs=prompt_input
863
+ )
864
+ clothes_change_btn1.click(
865
+ fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๊ฒ”)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์™€ (#3์˜ ์ฒญ๋ฐ”์ง€)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ๊ฒƒ ์ฒ˜๋Ÿผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ.",
866
+ inputs=[],
867
+ outputs=prompt_input
868
+ )
869
+ clothes_change_btn2.click(
870
+ fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ ๊ฒƒ์ฒ˜๋Ÿผ (#3์˜ ์žฅ์†Œ)์—์„œ ์˜์ž์— ์•‰์•„ ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ.",
871
+ inputs=[],
872
+ outputs=prompt_input
873
+ )
874
+ holding_product_btn.click(
875
+ fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์น˜ํ•œ ์ฒด (#2์˜ ์™€์ธ์ž”)์„ ์—ฌ์„ฑ๋ชจ๋ธ์ด ํ™๋ณดํ•  ์™€์ธ์ž”์„ ๋‹๋ณด์ด๊ฒŒ ๋“ค๊ณ  ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ๋ชจ์Šต์œผ๋กœ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ.",
876
+ inputs=[],
877
+ outputs=prompt_input
878
+ )
879
+ background_change_btn.click(
880
+ fn=lambda: "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2 ์ด๋ฏธ์ง€์˜ ๋ฐฐ๊ฒฝ)์„ ์ฃผ์š” ํ”ผ์‚ฌ์ฒด๋Š” ๊ทธ๋Œ€๋กœ ์œ ์ง€ํ•˜์—ฌ ๋‘ ์ด๋ฏธ์ง€์˜ ๋ถ„์œ„๊ธฐ๊ฐ€ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ƒ์„ฑํ•˜๋ผ.",
881
+ inputs=[],
882
+ outputs=prompt_input
883
+ )
884
+ composite_product_btn.click(
885
+ fn=lambda: "(#1์˜ ๋ ˆ๊ณ ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋ฅผ ์ œ๊ฑฐํ•œ ํ›„, ๊ทธ ์ž๋ฆฌ๋ฅผ ์ฃผ๋ณ€ ๋ฐฐ๊ฒฝ๊ณผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ฑ„์›Œ์ฃผ์„ธ์š”. ๋‹จ, ์ด๋ฏธ์ง€์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์˜ ์ฃผ์š” ์š”์†Œ๋Š” ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•ด ํ•ด์•ผํ•œ๋‹ค.",
886
+ inputs=[],
887
+ outputs=prompt_input
888
+ )
889
+ submit_btn.click(
890
+ fn=generate_multiple_images,
891
+ inputs=[image1_input, image2_input, image3_input, prompt_input],
892
+ outputs=[output_image1, output_image2, output_image3, output_image4, output_text, prompt_display],
893
+ )
894
+
895
+ gfpgan_btn.click(
896
+ fn=upscaler_korean,
897
+ inputs=gfpgan_input,
898
+ outputs=gfpgan_output
899
+ )
900
+
901
+ demo.queue()
902
+ demo.launch()