Spaces:
ssboost
/
Runtime error

ssboost commited on
Commit
0afb64c
ยท
verified ยท
1 Parent(s): 73d4b03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +745 -1
app.py CHANGED
@@ -1,2 +1,746 @@
1
  import os
2
- exec(os.environ.get('APP'))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
+ import tempfile
3
+ from PIL import Image, ImageEnhance, ImageFilter
4
+ import gradio as gr
5
+ import logging
6
+ import re
7
+ import time
8
+ import cv2
9
+ import numpy as np
10
+ from io import BytesIO
11
+ from datetime import datetime, timedelta
12
+ import random
13
+ from dotenv import load_dotenv
14
+ from gradio_client import Client, handle_file
15
+
16
+ load_dotenv()
17
+
18
+ # ๋กœ๊น… ์„ค์ •
19
+ logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
20
+ logger = logging.getLogger(__name__)
21
+
22
+
23
+ # API ์—”๋“œํฌ์ธํŠธ ์„ค์ • (ํ™˜๊ฒฝ๋ณ€์ˆ˜์—์„œ๋งŒ ์„ค์ •)
24
+ API_ENDPOINT = os.environ.get("API_ENDPOINT", "")
25
+
26
+ if not API_ENDPOINT:
27
+ raise ValueError("API_ENDPOINT ํ™˜๊ฒฝ๋ณ€์ˆ˜๊ฐ€ ์„ค์ •๋˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.")
28
+
29
+ # ํด๋ผ์ด์–ธํŠธ ์ดˆ๊ธฐํ™”
30
+ try:
31
+ client = Client(API_ENDPOINT)
32
+ logger.info("ํด๋ผ์ด์–ธํŠธ ์ดˆ๊ธฐํ™” ์™„๋ฃŒ")
33
+ except Exception as e:
34
+ logger.error(f"ํด๋ผ์ด์–ธํŠธ ์ดˆ๊ธฐํ™” ์‹คํŒจ: {e}")
35
+ raise
36
+
37
+ def safe_client_call(api_name, **kwargs):
38
+ """์•ˆ์ „ํ•œ ํด๋ผ์ด์–ธํŠธ ํ˜ธ์ถœ ํ•จ์ˆ˜"""
39
+ try:
40
+ return client.predict(api_name=api_name, **kwargs)
41
+ except Exception as e:
42
+ logger.error(f"API ํ˜ธ์ถœ ์‹คํŒจ ({api_name}): {e}")
43
+ return None
44
+
45
+ def convert_image_to_file(image):
46
+ """PIL Image ๊ฐ์ฒด๋ฅผ ์ž„์‹œ ํŒŒ์ผ๋กœ ๋ณ€ํ™˜"""
47
+ if image is None:
48
+ return None
49
+
50
+ try:
51
+ # PIL Image ๊ฐ์ฒด์ธ ๊ฒฝ์šฐ
52
+ if hasattr(image, 'save'):
53
+ # ์ž„์‹œ ํŒŒ์ผ ์ƒ์„ฑ
54
+ temp_file = tempfile.NamedTemporaryFile(suffix='.png', delete=False)
55
+ image.save(temp_file.name, format='PNG')
56
+ temp_file.close()
57
+ return temp_file.name
58
+ # ์ด๋ฏธ ํŒŒ์ผ ๊ฒฝ๋กœ์ธ ๊ฒฝ์šฐ
59
+ elif isinstance(image, str):
60
+ return image
61
+ # ๊ธฐํƒ€ ๊ฒฝ์šฐ
62
+ else:
63
+ return image
64
+ except Exception as e:
65
+ logger.error(f"์ด๋ฏธ์ง€ ํŒŒ์ผ ๋ณ€ํ™˜ ์‹คํŒจ: {e}")
66
+ return None
67
+
68
+ # ========== ์ด๋ฏธ์ง€ ์ƒ์„ฑ๊ธฐ ๊ด€๋ จ ํ•จ์ˆ˜ (ํด๋ผ์ด์–ธํŠธ API ํ™œ์šฉ) ==========
69
+ def generate_single_image(image1, image2, image3, prompt):
70
+ """๋‹จ์ผ ์ด๋ฏธ์ง€ ์ƒ์„ฑ - ์›๋ณธ ํ•จ์ˆ˜๋ช… ์œ ์ง€"""
71
+ try:
72
+ # ์ด๋ฏธ์ง€ ํŒŒ์ผ ์ฒ˜๋ฆฌ - PIL Image๋ฅผ ์ž„์‹œ ํŒŒ์ผ๋กœ ๋ณ€ํ™˜
73
+ image1_path = convert_image_to_file(image1)
74
+ image2_path = convert_image_to_file(image2)
75
+ image3_path = convert_image_to_file(image3)
76
+
77
+ # handle_file๋กœ ์ฒ˜๋ฆฌ
78
+ image1_file = handle_file(image1_path) if image1_path else None
79
+ image2_file = handle_file(image2_path) if image2_path else None
80
+ image3_file = handle_file(image3_path) if image3_path else None
81
+
82
+ result = safe_client_call(
83
+ "/generate_single_image",
84
+ image1=image1_file,
85
+ image2=image2_file,
86
+ image3=image3_file,
87
+ prompt=prompt
88
+ )
89
+
90
+ if result:
91
+ return result[0], result[1], result[2]
92
+ else:
93
+ return None, "API ํ˜ธ์ถœ ์‹คํŒจ", ""
94
+
95
+ except Exception as e:
96
+ logger.error(f"๋‹จ์ผ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ์‹คํŒจ: {e}")
97
+ return None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}", ""
98
+
99
+ def generate_multiple_images(image1, image2, image3, prompt, progress=gr.Progress()):
100
+ """๋‹ค์ค‘ ์ด๋ฏธ์ง€ ์ƒ์„ฑ - ์›๋ณธ ํ•จ์ˆ˜๋ช… ์œ ์ง€"""
101
+ try:
102
+ progress(0, desc="์ด๋ฏธ์ง€ ์ƒ์„ฑ ์ค€๋น„ ์ค‘...")
103
+
104
+ # ์ด๋ฏธ์ง€ ํŒŒ์ผ ์ฒ˜๋ฆฌ - PIL Image๋ฅผ ์ž„์‹œ ํŒŒ์ผ๋กœ ๋ณ€ํ™˜
105
+ image1_path = convert_image_to_file(image1)
106
+ image2_path = convert_image_to_file(image2)
107
+ image3_path = convert_image_to_file(image3)
108
+
109
+ # handle_file๋กœ ์ฒ˜๋ฆฌ
110
+ image1_file = handle_file(image1_path) if image1_path else None
111
+ image2_file = handle_file(image2_path) if image2_path else None
112
+ image3_file = handle_file(image3_path) if image3_path else None
113
+
114
+ progress(0.5, desc="์ด๋ฏธ์ง€ ์ƒ์„ฑ ์ค‘...")
115
+
116
+ result = safe_client_call(
117
+ "/generate_multiple_images",
118
+ image1=image1_file,
119
+ image2=image2_file,
120
+ image3=image3_file,
121
+ prompt=prompt
122
+ )
123
+
124
+ progress(1.0, desc="์ด๋ฏธ์ง€ ์ƒ์„ฑ ์™„๋ฃŒ!")
125
+
126
+ if result:
127
+ return result[0], result[1], result[2], result[3]
128
+ else:
129
+ return None, None, "API ํ˜ธ์ถœ ์‹คํŒจ", ""
130
+
131
+ except Exception as e:
132
+ logger.error(f"๋‹ค์ค‘ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ์‹คํŒจ: {e}")
133
+ return None, None, f"์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}", ""
134
+
135
+ # ========== ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ ํ•จ์ˆ˜๋“ค - ํด๋ผ์ด์–ธํŠธ API ํ™œ์šฉ ==========
136
+ def get_prompt_template_1():
137
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 1 - ๋ถ€๋ถ„๋ณ€๊ฒฝ-1"""
138
+ return "(#1์˜ ์—ฌ์„ฑ)์ด ์‚ด์ง ๋’ค๋กœ ๋Œ์•„๋ณด๋Š” ๋ชจ์Šต์œผ๋กœ ์ตœ๋Œ€ํ•œ ์ด์ „ seed๋ฅผ ์œ ์ง€ํ•œํ…Œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ณ€๊ฒฝํ•˜๋ผ."
139
+
140
+ def get_prompt_template_2():
141
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 2 - ๋ถ€๋ถ„๋ณ€๊ฒฝ-2"""
142
+ return "(#1 ๋ ˆ๋ชจ๋ชจํ˜•)๏ฟฝ๏ฟฝ์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋งŒ ๊ฒ€์€์ƒ‰ ๊ณ ๋ž˜๋ ˆ๊ณ ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋‚˜๋จธ์ง€ ๋ถ€๋ถ„์€ seed๋ฅผ ๋ณ€๊ฒฝ์„ ํ•˜์ง€๋งˆ๋ผ."
143
+
144
+ def get_prompt_template_3():
145
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 3 - ๋ถ€๋ถ„๋ณ€๊ฒฝ-3"""
146
+ return "(#1 ์—ฌํ–‰์šฉ ์–ผ์Œ๋ฐ•์Šค)์•ž์— ์–ผ์Œ์ด ๋‹ด๊ธด 3์ž”์˜ ์ฝœ๋ผ๊ฐ€ ๋†“์—ฌ์žˆ๋Š” ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."
147
+
148
+ def get_prompt_template_4():
149
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 4 - ๊ธ€์ž์ง€์šฐ๊ธฐ"""
150
+ return "(#1 ์ด๋ฏธ์ง€)์— ์žˆ๋Š” ์ค‘๊ตญ์–ด๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋ผ."
151
+
152
+ def get_prompt_template_5():
153
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 5 - ๊ธ€์ž๋ณ€๊ฒฝ"""
154
+ return '(#1์˜ ํ…์ŠคํŠธ)๋ฅผ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•œ์ฒด ํ…์ŠคํŠธ๋งŒ "Hello"๋กœ ๋ฐ”๊ฟ”๋ผ'
155
+
156
+ def get_prompt_template_6():
157
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 6 - ์ƒํ’ˆ์ฐฉ์šฉ-1"""
158
+ return "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์ง€ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์™€ (#3์˜ ์ฒญ๋ฐ”์ง€)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ๊ฒƒ ์ฒ˜๋Ÿผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๋ผ."
159
+
160
+ def get_prompt_template_7():
161
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 7 - ์ƒํ’ˆ์ฐฉ์šฉ-2"""
162
+ return "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์„ ์ฐฉ์šฉํ•˜๊ณ  (#3์˜ ๋’ท๋ฐฐ๊ฒฝ์˜ ์นดํŽ˜์ „์ฒด๊ฐ€ ๋ณด์ด๋ฉฐ) ์˜์ž์— ์•‰์•„ ์žˆ๋Š” ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๋ผ."
163
+
164
+ def get_prompt_template_8():
165
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 8 - ์ƒํ’ˆ๋“ค๊ณ """
166
+ return "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด(#2์˜ ์™€์ธ์ž”)์„ ๋“ค๊ณ  ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๋ผ."
167
+
168
+ def get_prompt_template_9():
169
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 9 - ๋ฐฐ๊ฒฝ๋ฐ”๊พธ๊ธฐ"""
170
+ return "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2 ์นดํŽ˜)์—์„œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์žˆ๋Š” ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๋ผ."
171
+
172
+ def get_prompt_template_10():
173
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 10 - ๋ถ€๋ถ„์ง€์šฐ๊ธฐ"""
174
+ return "(#1์˜ ๋ ˆ๊ณ ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋ฅผ ์ œ๊ฑฐํ•œ ํ›„, ๊ทธ ์ž๋ฆฌ๋ฅผ ์ฃผ๋ณ€ ๋ฐฐ๊ฒฝ๊ณผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ฑ„์›Œ์ฃผ์„ธ์š”. ๋‹จ, ์ด๋ฏธ์ง€์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์˜ ์ฃผ์š” ์š”์†Œ๋Š” ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ ํ•ด์•ผํ•œ๋‹ค."
175
+
176
+ def get_prompt_template_11():
177
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 11 - ์ด๋ฏธ์ง€ํ™•์žฅ"""
178
+ return "(#1 ์ด๋ฏธ์ง€)๋ฅผ ์›๋ณธ๊ทธ๋Œ€๋กœ ์ค‘์•™์— ๋‘๊ณ  ๋น„์œจ๋กœ ์œ ์ง€ํ•œ ์ฒด ์œ„์•„๋ž˜ ๋ฐ ์ขŒ์šฐ๋กœ ํฌ๊ฒŒ ํ™•์žฅํ•˜๋ผ."
179
+
180
+ def get_prompt_template_12():
181
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 12 - ํ”Œ๋ ˆ์ดํŒ…-1"""
182
+ return "(#1์…€๋Ÿฌ๋“œ)์— ๋‹ด์€ ์šฉ๊ธฐ๋Š” ๋ฒ„๋ฆฌ๊ณ  ๋„“๊ณ  ํฐ ์˜ˆ์œ ์ ‘์‹œ์— (#1์…€๋Ÿฌ๋“œ)์Œ์‹๋งŒ ๊ฐ€๋“ ์ฑ„์›Œ์„œ ์ƒ์—…์ ์ธ ๊ฐ๋„๋กœ ์–ด์šธ๋ฆฌ๋Š” ์†Œํ’ˆ๊ณผ ํ•จ๊ป˜ ํ”Œ๋ ˆ์ดํŒ… ํ•œ ๋ชจ์Šต์„ ์ด๋ฏธ์ง€๋กœ ์ƒ์„ฑํ•˜๋ผ. "
183
+
184
+ def get_prompt_template_13():
185
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 13 - ํ”Œ๋ ˆ์ดํŒ…-2"""
186
+ return "(#2 ํ”Œ๋ ˆ์ดํŒ…ํ•œ ์ด๋ฏธ์ง€)์— ๋‹ด๊ธด ์Œ์‹์„ (#1 ์ƒ๋Ÿฌ๋“œ)๋กœ ๋ฐ”๊พธ๊ณ  ๋‚˜๋จธ์ง€๋Š” ์‹œ๋“œ๋ฅผ ์œ ์ง€ํ•œ ์ฒด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."
187
+
188
+ def get_prompt_template_14():
189
+ """ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ 14 - ํ”Œ๋ ˆ์ดํŒ…-3"""
190
+ return "(#1์ปต)์— ๋”ธ๊ธฐ, ๋ฐ”๋‹๋ผ, ์ดˆ์ฝ” ์•„์ด์Šคํฌ๋ฆผ์„ ๋‹ด๊ณ  ๊ทธ ์œ„์— ์ดˆ์ฝ” ์‹œ๋Ÿฝ์ด ํ๋ฅด๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."
191
+
192
+ # ๋‹คํฌ๋ชจ๋“œ ์ž๋™ ์ ์šฉ ์ปค์Šคํ…€ CSS ์Šคํƒ€์ผ
193
+ custom_css = """
194
+ /* ============================================
195
+ ๋‹คํฌ๋ชจ๋“œ ์ž๋™ ๋ณ€๊ฒฝ ํ…œํ”Œ๋ฆฟ CSS
196
+ ============================================ */
197
+
198
+ /* 1. CSS ๋ณ€์ˆ˜ ์ •์˜ (๋ผ์ดํŠธ๋ชจ๋“œ - ๊ธฐ๋ณธ๊ฐ’) */
199
+ :root {
200
+ /* ๋ฉ”์ธ ์ปฌ๋Ÿฌ */
201
+ --primary-color: #FB7F0D;
202
+ --secondary-color: #ff9a8b;
203
+ --accent-color: #FF6B6B;
204
+
205
+ /* ๋ฐฐ๊ฒฝ ์ปฌ๋Ÿฌ */
206
+ --background-color: #FFFFFF;
207
+ --card-bg: #ffffff;
208
+ --input-bg: #ffffff;
209
+
210
+ /* ํ…์ŠคํŠธ ์ปฌ๋Ÿฌ */
211
+ --text-color: #334155;
212
+ --text-secondary: #64748b;
213
+
214
+ /* ๋ณด๋” ๋ฐ ๊ตฌ๋ถ„์„  */
215
+ --border-color: #dddddd;
216
+ --border-light: #e5e5e5;
217
+
218
+ /* ํ…Œ์ด๋ธ” ์ปฌ๋Ÿฌ */
219
+ --table-even-bg: #f3f3f3;
220
+ --table-hover-bg: #f0f0f0;
221
+
222
+ /* ๊ทธ๋ฆผ์ž */
223
+ --shadow: 0 8px 30px rgba(251, 127, 13, 0.08);
224
+ --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.1);
225
+
226
+ /* ๊ธฐํƒ€ */
227
+ --border-radius: 18px;
228
+ }
229
+
230
+ /* 2. ๋‹คํฌ๋ชจ๋“œ ์ƒ‰์ƒ ๋ณ€์ˆ˜ (์ž๋™ ๊ฐ์ง€) */
231
+ @media (prefers-color-scheme: dark) {
232
+ :root {
233
+ /* ๋ฐฐ๊ฒฝ ์ปฌ๋Ÿฌ */
234
+ --background-color: #1a1a1a;
235
+ --card-bg: #2d2d2d;
236
+ --input-bg: #2d2d2d;
237
+
238
+ /* ํ…์ŠคํŠธ ์ปฌ๋Ÿฌ */
239
+ --text-color: #e5e5e5;
240
+ --text-secondary: #a1a1aa;
241
+
242
+ /* ๋ณด๋” ๋ฐ ๊ตฌ๋ถ„์„  */
243
+ --border-color: #404040;
244
+ --border-light: #525252;
245
+
246
+ /* ํ…Œ์ด๋ธ” ์ปฌ๋Ÿฌ */
247
+ --table-even-bg: #333333;
248
+ --table-hover-bg: #404040;
249
+
250
+ /* ๊ทธ๋ฆผ์ž */
251
+ --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
252
+ --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.2);
253
+ }
254
+ }
255
+
256
+ /* 3. ์ˆ˜๋™ ๋‹คํฌ๋ชจ๋“œ ํด๋ž˜์Šค (Gradio ํ† ๊ธ€์šฉ) */
257
+ [data-theme="dark"],
258
+ .dark,
259
+ .gr-theme-dark {
260
+ /* ๋ฐฐ๊ฒฝ ์ปฌ๋Ÿฌ */
261
+ --background-color: #1a1a1a;
262
+ --card-bg: #2d2d2d;
263
+ --input-bg: #2d2d2d;
264
+
265
+ /* ํ…์ŠคํŠธ ์ปฌ๋Ÿฌ */
266
+ --text-color: #e5e5e5;
267
+ --text-secondary: #a1a1aa;
268
+
269
+ /* ๋ณด๋” ๋ฐ ๊ตฌ๋ถ„์„  */
270
+ --border-color: #404040;
271
+ --border-light: #525252;
272
+
273
+ /* ํ…Œ์ด๋ธ” ์ปฌ๋Ÿฌ */
274
+ --table-even-bg: #333333;
275
+ --table-hover-bg: #404040;
276
+
277
+ /* ๊ทธ๋ฆผ์ž */
278
+ --shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
279
+ --shadow-light: 0 2px 4px rgba(0, 0, 0, 0.2);
280
+ }
281
+
282
+ /* 4. ๊ธฐ๋ณธ ์š”์†Œ ๋‹คํฌ๋ชจ๋“œ ์ ์šฉ */
283
+ body {
284
+ font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
285
+ background-color: var(--background-color) !important;
286
+ color: var(--text-color) !important;
287
+ line-height: 1.6;
288
+ transition: background-color 0.3s ease, color 0.3s ease;
289
+ }
290
+
291
+ /* 5. Gradio ์ปจํ…Œ์ด๋„ˆ ๊ฐ•์ œ ์ ์šฉ */
292
+ .gradio-container,
293
+ .gradio-container *,
294
+ .gr-app,
295
+ .gr-app *,
296
+ .gr-interface {
297
+ background-color: var(--background-color) !important;
298
+ color: var(--text-color) !important;
299
+ }
300
+
301
+ /* Gradio ์ปจํ…Œ์ด๋„ˆ ์˜ค๋ฒ„๋ผ์ด๋“œ */
302
+ .gradio-container {
303
+ max-width: 100% !important;
304
+ width: 100% !important;
305
+ margin: 0 auto !important;
306
+ padding: 0 !important;
307
+ background-color: var(--background-color) !important;
308
+ box-sizing: border-box !important;
309
+ }
310
+
311
+ /* ์ถ”๊ฐ€: ๋‚ด๋ถ€ ์ปจํ…Œ์ด๋„ˆ๋„ 100% ๋„ˆ๋น„๋กœ ์„ค์ • */
312
+ .contain {
313
+ max-width: 100% !important;
314
+ width: 100% !important;
315
+ }
316
+
317
+ /* ์ถ”๊ฐ€: ๊ฐ ํ–‰(Row)๋„ 100% ๋„ˆ๋น„๋กœ ์„ค์ • */
318
+ .gr-padded {
319
+ padding: 0 !important;
320
+ width: 100% !important;
321
+ max-width: 100% !important;
322
+ }
323
+
324
+ /* 6. ์นด๋“œ ๋ฐ ํŒจ๋„ ์Šคํƒ€์ผ */
325
+ .gr-group,
326
+ .gr-form,
327
+ .gr-box,
328
+ .gr-panel,
329
+ .custom-frame,
330
+ [class*="frame"],
331
+ [class*="card"],
332
+ [class*="panel"] {
333
+ background-color: var(--card-bg) !important;
334
+ border-radius: var(--border-radius) !important;
335
+ box-shadow: var(--shadow) !important;
336
+ padding: 1.5rem !important;
337
+ margin-bottom: 1.5rem !important;
338
+ border: 1px solid var(--border-color) !important;
339
+ transition: transform 0.3s ease, background-color 0.3s ease;
340
+ color: var(--text-color) !important;
341
+ }
342
+
343
+ .gr-group:hover {
344
+ transform: translateY(-5px);
345
+ }
346
+
347
+ /* 7. ์ž…๋ ฅ ํ•„๋“œ ์Šคํƒ€์ผ */
348
+ input[type="text"],
349
+ input[type="number"],
350
+ input[type="email"],
351
+ input[type="password"],
352
+ textarea,
353
+ select,
354
+ .gr-input,
355
+ .gr-text-input,
356
+ .gr-textarea,
357
+ .gr-dropdown {
358
+ background-color: var(--input-bg) !important;
359
+ color: var(--text-color) !important;
360
+ border: 1px solid var(--border-color) !important;
361
+ border-radius: var(--border-radius) !important;
362
+ padding: 12px !important;
363
+ box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05) !important;
364
+ transition: all 0.3s ease !important;
365
+ }
366
+
367
+ input[type="text"]:focus,
368
+ input[type="number"]:focus,
369
+ input[type="email"]:focus,
370
+ input[type="password"]:focus,
371
+ textarea:focus,
372
+ select:focus,
373
+ .gr-input:focus,
374
+ .gr-text-input:focus,
375
+ .gr-textarea:focus,
376
+ .gr-dropdown:focus {
377
+ border-color: var(--primary-color) !important;
378
+ outline: none !important;
379
+ box-shadow: 0 0 0 2px rgba(251, 127, 13, 0.2) !important;
380
+ }
381
+
382
+ /* 8. ๋ผ๋ฒจ ๋ฐ ํ…์ŠคํŠธ ์š”์†Œ */
383
+ label,
384
+ .gr-label,
385
+ .gr-checkbox label,
386
+ .gr-radio label,
387
+ p, span, div {
388
+ color: var(--text-color) !important;
389
+ }
390
+
391
+ /* 9. ์„น์…˜ ์ œ๋ชฉ */
392
+ .section-title {
393
+ font-size: 22px !important;
394
+ font-weight: 700 !important;
395
+ color: var(--text-color) !important;
396
+ margin-bottom: 1rem !important;
397
+ padding-bottom: 0.5rem !important;
398
+ border-bottom: 2px solid var(--primary-color) !important;
399
+ display: flex;
400
+ align-items: center;
401
+ }
402
+
403
+ .section-title span {
404
+ color: var(--primary-color);
405
+ }
406
+
407
+ /* 10. ๋ฒ„ํŠผ ์Šคํƒ€์ผ๋ง */
408
+ .custom-button {
409
+ background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)) !important;
410
+ color: white !important;
411
+ font-weight: 600 !important;
412
+ border: none !important;
413
+ border-radius: 30px !important;
414
+ padding: 12px 24px !important;
415
+ box-shadow: 0 4px 8px rgba(251, 127, 13, 0.25) !important;
416
+ transition: all 0.3s ease !important;
417
+ text-transform: none !important;
418
+ display: flex !important;
419
+ align-items: center !important;
420
+ justify-content: center !important;
421
+ }
422
+
423
+ .custom-button:hover {
424
+ transform: translateY(-2px) !important;
425
+ box-shadow: 0 6px 12px rgba(251, 127, 13, 0.3) !important;
426
+ }
427
+
428
+ .custom-button.primary {
429
+ background: linear-gradient(135deg, var(--accent-color), #ff9a8b) !important;
430
+ }
431
+
432
+ button:not([class*="custom"]):not([class*="primary"]):not([class*="secondary"]) {
433
+ background-color: var(--card-bg) !important;
434
+ color: var(--text-color) !important;
435
+ border: 1px solid var(--border-color) !important;
436
+ border-radius: var(--border-radius) !important;
437
+ transition: all 0.3s ease !important;
438
+ }
439
+
440
+ /* 11. ์ด๋ฏธ์ง€ ์ปจํ…Œ์ด๋„ˆ */
441
+ .image-container {
442
+ border-radius: var(--border-radius);
443
+ overflow: hidden;
444
+ border: 1px solid var(--border-color);
445
+ transition: all 0.3s ease;
446
+ background-color: var(--card-bg);
447
+ }
448
+
449
+ .image-container:hover {
450
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
451
+ }
452
+
453
+ /* 12. ํ…Œ์ด๋ธ” ์Šคํƒ€์ผ */
454
+ table {
455
+ background-color: var(--card-bg) !important;
456
+ color: var(--text-color) !important;
457
+ border-color: var(--border-color) !important;
458
+ }
459
+
460
+ table th {
461
+ background-color: var(--primary-color) !important;
462
+ color: white !important;
463
+ border-color: var(--border-color) !important;
464
+ }
465
+
466
+ table td {
467
+ background-color: var(--card-bg) !important;
468
+ color: var(--text-color) !important;
469
+ border-color: var(--border-color) !important;
470
+ }
471
+
472
+ table tbody tr:nth-child(even) {
473
+ background-color: var(--table-even-bg) !important;
474
+ }
475
+
476
+ table tbody tr:hover {
477
+ background-color: var(--table-hover-bg) !important;
478
+ }
479
+
480
+ /* 13. ์ฒดํฌ๋ฐ•์Šค ๋ฐ ๋ผ๋””์˜ค ๋ฒ„ํŠผ */
481
+ input[type="checkbox"],
482
+ input[type="radio"] {
483
+ accent-color: var(--primary-color) !important;
484
+ }
485
+
486
+ /* 14. ๋ฒ„ํŠผ ๊ทธ๋ฃน */
487
+ .button-grid {
488
+ display: grid;
489
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
490
+ gap: 0.8rem;
491
+ margin-bottom: 1.2rem;
492
+ }
493
+
494
+ /* 15. ์Šคํฌ๋กค๋ฐ” ์Šคํƒ€์ผ */
495
+ ::-webkit-scrollbar-thumb:hover {
496
+ background: var(--secondary-color);
497
+ }
498
+
499
+ /* 16. ์•„์ฝ”๋””์–ธ ๋ฐ ๋“œ๋กญ๋‹ค์šด */
500
+ details {
501
+ background-color: var(--card-bg) !important;
502
+ border-color: var(--border-color) !important;
503
+ color: var(--text-color) !important;
504
+ }
505
+
506
+ details summary {
507
+ background-color: var(--card-bg) !important;
508
+ color: var(--text-color) !important;
509
+ }
510
+
511
+ /* 17. ํˆดํŒ ๋ฐ ํŒ์—… */
512
+ [data-tooltip]:hover::after,
513
+ .tooltip,
514
+ .popup {
515
+ background-color: var(--card-bg) !important;
516
+ color: var(--text-color) !important;
517
+ border-color: var(--border-color) !important;
518
+ box-shadow: var(--shadow-light) !important;
519
+ }
520
+
521
+ /* 18. ๋ชจ๋‹ฌ ๋ฐ ์˜ค๋ฒ„๋ ˆ์ด */
522
+ .modal,
523
+ .overlay,
524
+ [class*="modal"],
525
+ [class*="overlay"] {
526
+ background-color: var(--card-bg) !important;
527
+ color: var(--text-color) !important;
528
+ border-color: var(--border-color) !important;
529
+ }
530
+
531
+ /* 19. ์ถ”๊ฐ€ Gradio ์ปดํฌ๋„ŒํŠธ๋“ค */
532
+ .gr-block,
533
+ .gr-group,
534
+ .gr-row,
535
+ .gr-column {
536
+ background-color: var(--background-color) !important;
537
+ color: var(--text-color) !important;
538
+ }
539
+
540
+ /* 20. ์ฝ”๋“œ ๋ธ”๋ก ๋ฐ pre ํƒœ๊ทธ */
541
+ code,
542
+ pre,
543
+ .code-block {
544
+ background-color: var(--table-even-bg) !important;
545
+ color: var(--text-color) !important;
546
+ border-color: var(--border-color) !important;
547
+ }
548
+
549
+ /* 21. ์•Œ๋ฆผ ๋ฐ ๋ฉ”์‹œ์ง€ */
550
+ .alert,
551
+ .message,
552
+ .notification,
553
+ [class*="alert"],
554
+ [class*="message"],
555
+ [class*="notification"] {
556
+ background-color: var(--card-bg) !important;
557
+ color: var(--text-color) !important;
558
+ border-color: var(--border-color) !important;
559
+ }
560
+
561
+ /* 22. ์• ๋‹ˆ๋ฉ”์ด์…˜ ์Šคํƒ€์ผ */
562
+ @keyframes fadeIn {
563
+ from { opacity: 0; transform: translateY(10px); }
564
+ to { opacity: 1; transform: translateY(0); }
565
+ }
566
+
567
+ .fade-in {
568
+ animation: fadeIn 0.5s ease-out;
569
+ }
570
+
571
+ /* 23. Examples ์„น์…˜ ์Šคํƒ€์ผ */
572
+ .examples-section {
573
+ display: grid;
574
+ grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
575
+ gap: 1.5rem;
576
+ margin-top: 1rem;
577
+ }
578
+
579
+ .example-item {
580
+ background-color: var(--card-bg);
581
+ border-radius: var(--border-radius);
582
+ overflow: hidden;
583
+ box-shadow: var(--shadow);
584
+ transition: transform 0.3s ease, background-color 0.3s ease;
585
+ }
586
+
587
+ .example-item:hover {
588
+ transform: translateY(-5px);
589
+ }
590
+
591
+ /* 24. ์ „ํ™˜ ์• ๋‹ˆ๋ฉ”์ด์…˜ */
592
+ * {
593
+ transition: background-color 0.3s ease,
594
+ color 0.3s ease,
595
+ border-color 0.3s ease !important;
596
+ }
597
+
598
+ /* 25. ๋ฐ˜์‘ํ˜• */
599
+ @media (max-width: 768px) {
600
+ .button-grid {
601
+ grid-template-columns: repeat(2, 1fr);
602
+ }
603
+ .examples-section {
604
+ grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
605
+ }
606
+ }
607
+ """
608
+
609
+ # FontAwesome ์•„์ด์ฝ˜ ํฌํ•จ
610
+ fontawesome_link = """
611
+ <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
612
+ """
613
+
614
+ # ์ œ๋ชฉ๊ณผ ์‚ฌ์šฉ ๊ฐ€์ด๋“œ ์ œ๊ฑฐ
615
+ header_html = ""
616
+ image_generator_guide_html = ""
617
+
618
+ # UI ๊ตฌ์„ฑ
619
+ with gr.Blocks(css=custom_css, theme=gr.themes.Default(
620
+ primary_hue="orange",
621
+ secondary_hue="orange",
622
+ font=[gr.themes.GoogleFont("Noto Sans KR"), "ui-sans-serif", "system-ui"]
623
+ )) as demo:
624
+ gr.HTML(fontawesome_link)
625
+
626
+ with gr.Row(equal_height=True):
627
+ with gr.Column(scale=1):
628
+ # ======== ์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ๋ฐ ์„ค์ • ์„น์…˜ ========
629
+ with gr.Group():
630
+ gr.HTML('<div class="section-title"><i class="fas fa-upload"></i> <span>์ด๋ฏธ์ง€ ์—…๋กœ๋“œ ๋ฐ ์„ค์ •</span></div>')
631
+ with gr.Row():
632
+ image1_input = gr.Image(type="pil", label="#1", image_mode="RGB", elem_classes="image-container", height=400)
633
+ image2_input = gr.Image(type="pil", label="#2", image_mode="RGB", elem_classes="image-container", height=400)
634
+ image3_input = gr.Image(type="pil", label="#3", image_mode="RGB", elem_classes="image-container", height=400)
635
+
636
+ # ํ”„๋กฌํ”„ํŠธ ์ž…๋ ฅ ํ•„๋“œ ์ถ”๊ฐ€
637
+ prompt_input = gr.Textbox(
638
+ lines=3,
639
+ placeholder="ํ”„๋กฌํ”„ํŠธ๋ฅผ ์ž…๋ ฅํ•˜๊ฑฐ๋‚˜ ๋น„์›Œ๋‘๋ฉด ์ž๋™ ํ•ฉ์„ฑ๋ฉ๋‹ˆ๋‹ค. '#1', '#2', '#3'์œผ๋กœ ๊ฐ ์ด๋ฏธ์ง€๋ฅผ ์ฐธ์กฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.",
640
+ label="ํ”„๋กฌํ”„ํŠธ (์„ ํƒ ์‚ฌํ•ญ)",
641
+ elem_classes="gr-text-input"
642
+ )
643
+
644
+ # ======== ๋ณ€ํ™˜ ์˜ต์…˜ ์„น์…˜ ========
645
+ with gr.Group():
646
+ gr.HTML('<div class="section-title"><i class="fas fa-sliders-h"></i> <span>ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ</span></div>')
647
+ with gr.Column(elem_classes="button-grid"):
648
+ image_change_btn1 = gr.Button('๐Ÿ”„ ๋ถ€๋ถ„๋ณ€๊ฒฝ-1', elem_classes="custom-button")
649
+ image_change_btn2 = gr.Button('๐Ÿ”„ ๋ถ€๋ถ„๋ณ€๊ฒฝ-2', elem_classes="custom-button")
650
+ image_change_btn3= gr.Button('๐Ÿ”„ ๋ถ€๋ถ„๋ณ€๊ฒฝ-3', elem_classes="custom-button")
651
+ text_remove_btn = gr.Button('๐Ÿงน ๊ธ€์ž์ง€์šฐ๊ธฐ', elem_classes="custom-button")
652
+ text_change_btn = gr.Button('๐Ÿ”ค ๊ธ€์ž๋ณ€๊ฒฝ', elem_classes="custom-button")
653
+ clothes_change_btn1 = gr.Button('๐Ÿ‘• ์ƒํ’ˆ์ฐฉ์šฉ-1', elem_classes="custom-button")
654
+ clothes_change_btn2 = gr.Button('๐Ÿ‘“ ์ƒํ’ˆ์ฐฉ์šฉ-2', elem_classes="custom-button")
655
+ holding_product_btn = gr.Button('๐Ÿท ์ƒํ’ˆ๋“ค๊ณ ', elem_classes="custom-button")
656
+ background_change_btn = gr.Button('๐Ÿ–ผ๏ธ ๋ฐฐ๊ฒฝ๋ฐ”๊พธ๊ธฐ', elem_classes="custom-button")
657
+ composite_product_btn = gr.Button('โœ‚๏ธ ๋ถ€๋ถ„์ง€์šฐ๊ธฐ', elem_classes="custom-button")
658
+ outpainting_btn = gr.Button('๐Ÿ” ์ด๋ฏธ์ง€ํ™•์žฅ', elem_classes="custom-button")
659
+ food_btn_1 = gr.Button('๐Ÿฝ๏ธ ํ”Œ๋ ˆ์ดํŒ…-1', elem_classes="custom-button")
660
+ food_btn_2 = gr.Button('๐Ÿฝ๏ธ ํ”Œ๋ ˆ์ดํŒ…-2', elem_classes="custom-button")
661
+ food_btn_3 = gr.Button('๐Ÿฝ๏ธ ํ”Œ๋ ˆ์ดํŒ…-3', elem_classes="custom-button")
662
+
663
+ # ======== ์ด๋ฏธ์ง€ ์ƒ์„ฑ ์„น์…˜ ========
664
+ with gr.Group():
665
+ gr.HTML('<div class="section-title"><i class="fas fa-image"></i> <span>์ด๋ฏธ์ง€ ์ƒ์„ฑ</span></div>')
666
+ submit_single_btn = gr.Button('โœจ ์ด๋ฏธ์ง€ ์ƒ์„ฑ (1์žฅ)', elem_classes="custom-button primary")
667
+ submit_btn = gr.Button('โœจ ์ด๋ฏธ์ง€ ์ƒ์„ฑ (2์žฅ)', elem_classes="custom-button primary")
668
+
669
+ with gr.Column(scale=1):
670
+ # ======== ์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€ ์„น์…˜ ========
671
+ with gr.Group():
672
+ gr.HTML('<div class="section-title"><i class="fas fa-images"></i> <span>์ƒ์„ฑ๋œ ์ด๋ฏธ์ง€</span></div>')
673
+ with gr.Row():
674
+ with gr.Column():
675
+ output_image1 = gr.Image(label="์ด๋ฏธ์ง€ #1", elem_classes="image-container", height=400)
676
+ with gr.Column():
677
+ output_image2 = gr.Image(label="์ด๋ฏธ์ง€ #2", elem_classes="image-container", height=400)
678
+
679
+ # ======== ๊ฒฐ๊ณผ ์ •๋ณด ์„น์…˜ ========
680
+ with gr.Group():
681
+ gr.HTML('<div class="section-title"><i class="fas fa-info-circle"></i> <span>๊ฒฐ๊ณผ ์ •๋ณด</span></div>')
682
+ output_text = gr.Textbox(label="์ƒํƒœ ๋ฉ”์‹œ์ง€", lines=2, elem_classes="gr-text-input")
683
+ prompt_display = gr.Textbox(label="์‚ฌ์šฉ๋œ ํ”„๋กฌํ”„ํŠธ (์˜์–ด)", visible=True, lines=2, elem_classes="gr-text-input")
684
+
685
+ # ======== ์˜ˆ์ œ ์ด๋ฏธ์ง€ ์„น์…˜ ========
686
+ gr.HTML('<div class="section-title"><i class="fas fa-lightbulb"></i> <span>์˜ˆ์ œ ์ด๋ฏธ์ง€</span></div>')
687
+
688
+ # ๋ชจ๋“  ์˜ˆ์ œ ํ•œ ํŽ˜์ด์ง€์— ํ‘œ์‹œ
689
+ examples = [
690
+ ["down/๋ชจ๋ธ.jpg", None, None, "(#1์˜ ์—ฌ์„ฑ)์ด ์‚ด์ง ๋’ค๋กœ ๋Œ์•„๋ณด๋Š” ๋ชจ์Šต์œผ๋กœ ์ตœ๋Œ€ํ•œ ์ด์ „ seed๋ฅผ ์œ ์ง€ํ•œ์ฒด ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ณ€๊ฒฝํ•˜๋ผ."],
691
+ ["down/์ƒ์–ด๋ ˆ๊ณ ๋ชจํ˜•.png", None, None, "(#1 ๋ ˆ๋ชจ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋งŒ ๊ฒ€์€์ƒ‰ ๊ณ ๋ž˜๋ ˆ๊ณ ๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  ๋‚˜๋จธ์ง€ ๋ถ€๋ถ„์€ seed๋ฅผ ๋ณ€๊ฒฝ์„ ํ•˜์ง€๋งˆ๋ผ."],
692
+ ["down/์–ผ์Œ๊ฐ€๋ฐฉ.png", None, None, "(#1 ์—ฌํ–‰์šฉ ์–ผ์Œ๋ฐ•์Šค)์•ž์— ์–ผ์Œ์ด ๋‹ด๊ธด 3์ž”์˜ ์ฝœ๋ผ๊ฐ€ ๋†“์—ฌ์žˆ๋Š” ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
693
+ ["down/์ค‘๊ตญ์–ด.png", None, None, "(#1 ์ด๋ฏธ์ง€)์— ์žˆ๋Š” ์ค‘๊ตญ์–ด๋ฅผ ๋ชจ๋‘ ์ œ๊ฑฐํ•˜๋ผ."],
694
+ ["down/ํ…์ŠคํŠธ.webp", None, None, '(#1์˜ ํ…์ŠคํŠธ)๋ฅผ ์Šคํƒ€์ผ์„ ์œ ์ง€ํ•œ์ฒด ํ…์ŠคํŠธ๋งŒ "Hello"๋กœ ๋ฐ”๊ฟ”๋ผ'],
695
+ ["down/๋ชจ๋ธ2.png", "down/์„ ๊ธ€๋ผ์Šค.png", "down/์ฒญ๋ฐ”์ง€.png", "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด ์‹ ์ฒด ๋น„์œจ๊ณผ ํฌ์ฆˆ๋Š” ์œ ์ง€ํ•œ ์ฒด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์™€ (#3์˜ ์ฒญ๋ฐ”์ง€)๋ฅผ ์ง์ ‘ ๋ชจ๋ธ์ด ์ฐฉ์šฉํ•œ๊ฒƒ ์ฒ˜๋Ÿผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๋ผ."],
696
+ ["down/๋ชจ๋ธ2.png", "down/์„ ๊ธ€๋ผ์Šค.png", "down/์นดํŽ˜์ „๊ฒฝ.png", "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2์˜ ์„ ๊ธ€๋ผ์Šค)์„ ์ฐฉ์šฉํ•˜๊ณ  (#3์˜ ๋’ท๋ฐฐ๊ฒฝ์˜ ์นดํŽ˜์ „์ฒด๊ฐ€ ๋ณด์ด๋ฉฐ) ์˜์ž์— ์•‰์•„ ์žˆ๋Š” ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๋ผ."],
697
+ ["down/๋ชจ๋ธ2.png", "down/์™€์ธ์ž”.png", None, "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด(#2์˜ ์™€์ธ์ž”)์„ ๋“ค๊ณ  ์žˆ๋Š” ์ž์—ฐ์Šค๋Ÿฌ์šด ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๏ฟฝ๏ฟฝ๏ฟฝ."],
698
+ ["down/๋ชจ๋ธ2.png", "down/์นดํŽ˜์ „๊ฒฝ.png", None, "(#1์˜ ์—ฌ์„ฑ๋ชจ๋ธ)์ด (#2 ์นดํŽ˜)์—์„œ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์žˆ๋Š” ๋ชจ์Šต์„ ์ƒ์„ฑํ•˜๋ผ."],
699
+ ["down/์ƒ์–ด๋ ˆ๊ณ ๋ชจํ˜•.png", None, None, "(#1์˜ ๋ ˆ๊ณ ๋ชจํ˜•)์—์„œ ์ฒญ์ƒ‰์ƒ์–ด๋ ˆ๊ณ ๋ฅผ ์ œ๊ฑฐํ•œ ํ›„, ๊ทธ ์ž๋ฆฌ๋ฅผ ์ฃผ๋ณ€ ๋ฐฐ๊ฒฝ๊ณผ ์ž์—ฐ์Šค๋Ÿฝ๊ฒŒ ์–ด์šฐ๋Ÿฌ์ง€๋„๋ก ์ฑ„์›Œ์ฃผ์„ธ์š”. ๋‹จ, ์ด๋ฏธ์ง€์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์˜ ์ฃผ์š” ์š”์†Œ๋Š” ๋™์ผํ•˜๊ฒŒ ์œ ์ง€ํ•ด์•ผํ•œ๋‹ค."],
700
+ ["down/์นดํŽ˜์ „๊ฒฝ.png", None, None, "(#1 ์ด๋ฏธ์ง€)๋ฅผ ์›๋ณธ๊ทธ๋Œ€๋กœ ์ค‘์•™์— ๋‘๊ณ  ๋น„์œจ๋กœ ์œ ์ง€ํ•œ ์ฒด ์œ„์•„๋ž˜ ๋ฐ ์ขŒ์šฐ๋กœ ํฌ๊ฒŒ ํ™•์žฅํ•˜๋ผ."],
701
+ ["down/์ƒ๋Ÿฌ๋“œ.png", None, None, "(#1์…€๋Ÿฌ๋“œ)์— ๋‹ด์€ ์šฉ๊ธฐ๋Š” ๋ฒ„๋ฆฌ๊ณ  ๋„“๊ณ  ํฐ ์˜ˆ์œ ์ ‘์‹œ์— (#1์…€๋Ÿฌ๋“œ)์Œ์‹๋งŒ ๊ฐ€๋“ ์ฑ„์›Œ์„œ ์ƒ์—…์ ์ธ ๊ฐ๋„๋กœ ์–ด์šธ๋ฆฌ๋Š” ์†Œํ’ˆ๊ณผ ํ•จ๊ป˜ ํ”Œ๋ ˆ์ดํŒ… ํ•œ ๋ชจ์Šต์„ ์ด๋ฏธ์ง€๋กœ ์ƒ์„ฑํ•˜๋ผ. "],
702
+ ["down/์ƒ๋Ÿฌ๋“œ.png", "down/ํ”Œ๋ ˆ์ดํŒ….png", None, "(#2 ํ”Œ๋ ˆ์ดํŒ…ํ•œ ์ด๋ฏธ์ง€)์— ๋‹ด๊ธด ์Œ์‹์„ (#1 ์ƒ๋Ÿฌ๋“œ)๋กœ ๋ฐ”๊พธ๊ณ  ๋‚˜๋จธ์ง€๋Š” ์‹œ๋“œ๋ฅผ ์œ ์ง€ํ•œ ์ฒด ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."],
703
+ ["down/์ปต.png", None, None, "(#1์ปต)์— ๋”ธ๊ธฐ, ๋ฐ”๋‹๋ผ, ์ดˆ์ฝ” ์•„์ด์Šคํฌ๋ฆผ์„ ๋‹ด๊ณ  ๊ทธ ์œ„์— ์ดˆ์ฝ” ์‹œ๋Ÿฝ์ด ํ๋ฅด๊ฒŒ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๋ผ."]
704
+ ]
705
+
706
+ # ๋ชจ๋“  ์˜ˆ์ œ๋ฅผ ํ•œ ํŽ˜์ด์ง€์— ํ‘œ์‹œํ•˜๋„๋ก ์ˆ˜์ •๋œ ๋ถ€๋ถ„
707
+ gr.Examples(
708
+ examples=examples,
709
+ inputs=[image1_input, image2_input, image3_input, prompt_input],
710
+ examples_per_page=len(examples) # ๋ชจ๋“  ์˜ˆ์ œ๋ฅผ ํ•œ ํŽ˜์ด์ง€์— ํ‘œ์‹œ
711
+ )
712
+
713
+ # ========== ์ด๋ฏธ์ง€ ์ƒ์„ฑ๊ธฐ ์ด๋ฒคํŠธ ์—ฐ๊ฒฐ ==========
714
+ # ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ์—ฐ๊ฒฐ - ํ”„๋กฌํ”„ํŠธ ํ…œํ”Œ๋ฆฟ
715
+ image_change_btn1.click(fn=get_prompt_template_1, outputs=prompt_input)
716
+ image_change_btn2.click(fn=get_prompt_template_2, outputs=prompt_input)
717
+ image_change_btn3.click(fn=get_prompt_template_3, outputs=prompt_input)
718
+ text_remove_btn.click(fn=get_prompt_template_4, outputs=prompt_input)
719
+ text_change_btn.click(fn=get_prompt_template_5, outputs=prompt_input)
720
+ clothes_change_btn1.click(fn=get_prompt_template_6, outputs=prompt_input)
721
+ clothes_change_btn2.click(fn=get_prompt_template_7, outputs=prompt_input)
722
+ holding_product_btn.click(fn=get_prompt_template_8, outputs=prompt_input)
723
+ background_change_btn.click(fn=get_prompt_template_9, outputs=prompt_input)
724
+ composite_product_btn.click(fn=get_prompt_template_10, outputs=prompt_input)
725
+ outpainting_btn.click(fn=get_prompt_template_11, outputs=prompt_input)
726
+ food_btn_1.click(fn=get_prompt_template_12, outputs=prompt_input)
727
+ food_btn_2.click(fn=get_prompt_template_13, outputs=prompt_input)
728
+ food_btn_3.click(fn=get_prompt_template_14, outputs=prompt_input)
729
+
730
+ # ๋‹จ์ผ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ์—ฐ๊ฒฐ
731
+ submit_single_btn.click(
732
+ fn=generate_single_image,
733
+ inputs=[image1_input, image2_input, image3_input, prompt_input],
734
+ outputs=[output_image1, output_text, prompt_display],
735
+ )
736
+
737
+ # 2์žฅ ์ด๋ฏธ์ง€ ์ƒ์„ฑ ๋ฒ„ํŠผ ์ด๋ฒคํŠธ ์—ฐ๊ฒฐ
738
+ submit_btn.click(
739
+ fn=generate_multiple_images,
740
+ inputs=[image1_input, image2_input, image3_input, prompt_input],
741
+ outputs=[output_image1, output_image2, output_text, prompt_display],
742
+ )
743
+
744
+ # ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‹คํ–‰
745
+ demo.queue()
746
+ demo.launch(share=False, inbrowser=True, width="100%")