Update app.py
Browse files
app.py
CHANGED
@@ -133,6 +133,11 @@ def calc_tile_size(target_height, target_width, overlap_pixels, max_tile_width_s
|
|
133 |
|
134 |
new_target_height = best_adjusted_target_height
|
135 |
new_target_width = best_adjusted_target_width
|
|
|
|
|
|
|
|
|
|
|
136 |
tile_width = best_tile_width
|
137 |
tile_height = best_tile_height
|
138 |
|
@@ -142,7 +147,7 @@ def calc_tile_size(target_height, target_width, overlap_pixels, max_tile_width_s
|
|
142 |
print(f"Tile Width (max {max_tile_width_size}, divisible by 8): {tile_width}")
|
143 |
print(f"Columns: {num_cols} | Rows: {num_rows}")
|
144 |
print(f"Original Target: {target_height} x {target_width}")
|
145 |
-
print(f"Adjusted Target: {new_target_height} x {new_target_width}\n")
|
146 |
|
147 |
return new_target_height, new_target_width, tile_height, tile_width
|
148 |
|
@@ -159,25 +164,29 @@ def randomize_seed_fn(generation_seed: int, randomize_seed: bool) -> int:
|
|
159 |
return generation_seed
|
160 |
#endregion
|
161 |
|
162 |
-
# CSS
|
163 |
css = """
|
164 |
body {
|
165 |
-
background: linear-gradient(135deg, #
|
166 |
-
font-family: '
|
|
|
|
|
|
|
167 |
}
|
168 |
.gradio-container {
|
169 |
background: rgba(255, 255, 255, 0.95);
|
170 |
-
border-radius:
|
171 |
-
padding: 30px;
|
172 |
-
box-shadow: 0
|
173 |
-
|
|
|
174 |
}
|
175 |
.gradio-container h1 {
|
176 |
-
color: #
|
177 |
-
text-shadow:
|
178 |
}
|
179 |
-
.fillable {
|
180 |
-
width: 95% !important;
|
181 |
max-width: unset !important;
|
182 |
}
|
183 |
#examples_container {
|
@@ -187,40 +196,35 @@ body {
|
|
187 |
#examples_row {
|
188 |
justify-content: center;
|
189 |
}
|
190 |
-
|
191 |
-
|
192 |
-
button {
|
193 |
-
background: linear-gradient(145deg, #6a82fb, #fc5c7d);
|
194 |
-
color: #ffffff;
|
195 |
-
font-weight: bold;
|
196 |
-
border: none;
|
197 |
border-radius: 10px;
|
198 |
-
|
199 |
-
|
200 |
-
cursor: pointer;
|
201 |
-
transition: transform 0.2s ease, box-shadow 0.2s ease;
|
202 |
-
}
|
203 |
-
button:hover {
|
204 |
-
transform: translateY(-3px);
|
205 |
-
box-shadow: 0 8px 12px rgba(0, 0, 0, 0.3);
|
206 |
}
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
|
|
|
|
|
|
|
|
214 |
}
|
215 |
-
|
216 |
-
|
217 |
-
box-shadow: 0 0 10px rgba(106, 130, 251, 0.5);
|
218 |
}
|
219 |
"""
|
220 |
|
221 |
title = """
|
222 |
-
<h1 align="center" style="margin-bottom: 0.2em;">
|
223 |
-
|
|
|
|
|
|
|
224 |
"""
|
225 |
|
226 |
with gr.Blocks(css=css, title="SDXL Tiling Pipeline") as app:
|
@@ -282,10 +286,10 @@ with gr.Blocks(css=css, title="SDXL Tiling Pipeline") as app:
|
|
282 |
gr.Examples(
|
283 |
examples=[
|
284 |
[
|
285 |
-
"
|
286 |
-
"
|
287 |
-
"
|
288 |
-
|
289 |
7, 7, 7,
|
290 |
128,
|
291 |
30,
|
@@ -296,10 +300,10 @@ with gr.Blocks(css=css, title="SDXL Tiling Pipeline") as app:
|
|
296 |
1280
|
297 |
],
|
298 |
[
|
299 |
-
"
|
300 |
-
"
|
301 |
-
"
|
302 |
-
|
303 |
8, 8, 8,
|
304 |
100,
|
305 |
35,
|
@@ -310,10 +314,10 @@ with gr.Blocks(css=css, title="SDXL Tiling Pipeline") as app:
|
|
310 |
1280
|
311 |
],
|
312 |
[
|
313 |
-
"
|
314 |
-
"
|
315 |
-
"
|
316 |
-
|
317 |
6, 6, 6,
|
318 |
80,
|
319 |
25,
|
@@ -324,10 +328,10 @@ with gr.Blocks(css=css, title="SDXL Tiling Pipeline") as app:
|
|
324 |
1280
|
325 |
],
|
326 |
[
|
327 |
-
"
|
328 |
-
"
|
329 |
-
"
|
330 |
-
|
331 |
9, 9, 9,
|
332 |
150,
|
333 |
40,
|
|
|
133 |
|
134 |
new_target_height = best_adjusted_target_height
|
135 |
new_target_width = best_adjusted_target_width
|
136 |
+
|
137 |
+
# ★ 새로 계산된 target 높이와 너비가 8로 나누어 떨어지도록 조정 (오류 방지)
|
138 |
+
new_target_height = new_target_height - (new_target_height % 8)
|
139 |
+
new_target_width = new_target_width - (new_target_width % 8)
|
140 |
+
|
141 |
tile_width = best_tile_width
|
142 |
tile_height = best_tile_height
|
143 |
|
|
|
147 |
print(f"Tile Width (max {max_tile_width_size}, divisible by 8): {tile_width}")
|
148 |
print(f"Columns: {num_cols} | Rows: {num_rows}")
|
149 |
print(f"Original Target: {target_height} x {target_width}")
|
150 |
+
print(f"Adjusted Target (divisible by 8): {new_target_height} x {new_target_width}\n")
|
151 |
|
152 |
return new_target_height, new_target_width, tile_height, tile_width
|
153 |
|
|
|
164 |
return generation_seed
|
165 |
#endregion
|
166 |
|
167 |
+
# CSS 개선: 입체감 있는 배경, 반투명 컨테이너, 그림자, 애니메이션 효과 등 적용
|
168 |
css = """
|
169 |
body {
|
170 |
+
background: linear-gradient(135deg, #667eea, #764ba2);
|
171 |
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
172 |
+
color: #333;
|
173 |
+
margin: 0;
|
174 |
+
padding: 0;
|
175 |
}
|
176 |
.gradio-container {
|
177 |
background: rgba(255, 255, 255, 0.95);
|
178 |
+
border-radius: 15px;
|
179 |
+
padding: 30px 40px;
|
180 |
+
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
|
181 |
+
margin: 40px auto;
|
182 |
+
max-width: 1200px;
|
183 |
}
|
184 |
.gradio-container h1 {
|
185 |
+
color: #333;
|
186 |
+
text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
|
187 |
}
|
188 |
+
.fillable {
|
189 |
+
width: 95% !important;
|
190 |
max-width: unset !important;
|
191 |
}
|
192 |
#examples_container {
|
|
|
196 |
#examples_row {
|
197 |
justify-content: center;
|
198 |
}
|
199 |
+
.sidebar {
|
200 |
+
background: rgba(255, 255, 255, 0.98);
|
|
|
|
|
|
|
|
|
|
|
201 |
border-radius: 10px;
|
202 |
+
padding: 20px;
|
203 |
+
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
}
|
205 |
+
button, .btn {
|
206 |
+
background: linear-gradient(90deg, #ff8a00, #e52e71);
|
207 |
+
border: none;
|
208 |
+
color: #fff;
|
209 |
+
padding: 12px 24px;
|
210 |
+
text-transform: uppercase;
|
211 |
+
font-weight: bold;
|
212 |
+
letter-spacing: 1px;
|
213 |
+
border-radius: 5px;
|
214 |
+
cursor: pointer;
|
215 |
+
transition: transform 0.2s ease-in-out;
|
216 |
}
|
217 |
+
button:hover, .btn:hover {
|
218 |
+
transform: scale(1.05);
|
|
|
219 |
}
|
220 |
"""
|
221 |
|
222 |
title = """
|
223 |
+
<h1 align="center" style="margin-bottom: 0.2em;">Mixture-of-Diffusers for SDXL Tiling Pipeline 🤗</h1>
|
224 |
+
<p align="center" style="font-size:1.1em; color:#555;">
|
225 |
+
좌/중앙/우 각 영역에 다른 프롬프트를 적용하여 타일링 이미지를 생성합니다.<br>
|
226 |
+
아래 예제를 클릭하면 입력창에 값이 채워집니다.
|
227 |
+
</p>
|
228 |
"""
|
229 |
|
230 |
with gr.Blocks(css=css, title="SDXL Tiling Pipeline") as app:
|
|
|
286 |
gr.Examples(
|
287 |
examples=[
|
288 |
[
|
289 |
+
"Lush green forest with sun rays filtering through the canopy",
|
290 |
+
"Crystal clear lake reflecting a vibrant sky",
|
291 |
+
"Majestic mountains with snowy peaks in the distance",
|
292 |
+
"blurry, low resolution, artifacts, poor details",
|
293 |
7, 7, 7,
|
294 |
128,
|
295 |
30,
|
|
|
300 |
1280
|
301 |
],
|
302 |
[
|
303 |
+
"Vibrant city street with neon signs and bustling crowds",
|
304 |
+
"Sleek modern skyscrapers with digital billboards",
|
305 |
+
"High-speed maglev train gliding over a futuristic urban landscape",
|
306 |
+
"blurry, poorly rendered, low quality, disfigured",
|
307 |
8, 8, 8,
|
308 |
100,
|
309 |
35,
|
|
|
314 |
1280
|
315 |
],
|
316 |
[
|
317 |
+
"Vibrant abstract strokes with fluid, swirling patterns in cool tones",
|
318 |
+
"Interlocking geometric shapes bursting with color and texture",
|
319 |
+
"Dynamic composition of splattered ink with smooth gradients",
|
320 |
+
"text, watermark, signature, distorted",
|
321 |
6, 6, 6,
|
322 |
80,
|
323 |
25,
|
|
|
328 |
1280
|
329 |
],
|
330 |
[
|
331 |
+
"Enchanted forest with glowing bioluminescent plants and mystical fog",
|
332 |
+
"Ancient castle with towering spires bathed in moonlight",
|
333 |
+
"Majestic dragon soaring above a starry night sky",
|
334 |
+
"low quality, artifact, deformed, sketchy",
|
335 |
9, 9, 9,
|
336 |
150,
|
337 |
40,
|