fantos commited on
Commit
6c65f48
·
verified ·
1 Parent(s): f7ba2e9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -55
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 강화: 그라데이션 배경, 입체적 그림자, 부드러운 전환 효과 등으로 UI를 비주얼하게 개선
163
  css = """
164
  body {
165
- background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
166
- font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
 
 
 
167
  }
168
  .gradio-container {
169
  background: rgba(255, 255, 255, 0.95);
170
- border-radius: 20px;
171
- padding: 30px;
172
- box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
173
- border: 1px solid rgba(255, 255, 255, 0.3);
 
174
  }
175
  .gradio-container h1 {
176
- color: #333333;
177
- text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
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
- box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
199
- padding: 10px 20px;
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
- input[type="text"], textarea {
210
- border: 2px solid #ddd;
211
- border-radius: 10px;
212
- padding: 10px;
213
- transition: border-color 0.3s ease, box-shadow 0.3s ease;
 
 
 
 
214
  }
215
- input[type="text"]:focus, textarea:focus {
216
- border-color: #6a82fb;
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;">Panorama X3 IMAGE 🤗</h1>
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
- "Iron Man, repulsor rays blasting enemies in destroyed cityscape, sparks, energy trails, crumbling skyscrapers, smoke, debris, cinematic lighting, photorealistic, intense action. Focus: Iron Man.",
286
- "Captain America charging forward, vibranium shield deflecting energy blasts in destroyed cityscape, collapsing buildings, rubble streets, battle-damaged suit, determined expression, distant explosions, cinematic composition, realistic rendering. Focus: Captain America.",
287
- "Thor wielding Stormbreaker in destroyed cityscape, lightning crackling, powerful strike downwards, shattered buildings, burning debris, ground trembling, Asgardian armor, cinematic photography, realistic details. Focus: Thor.",
288
- "blurry, low resolution, artifacts, poor details",
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
- "A charming house in the countryside, by jakub rozalski, sunset lighting, elegant, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
300
- "A dirt road in the countryside crossing pastures, by jakub rozalski, sunset lighting, elegant, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
301
- "An old and rusty giant robot lying on a dirt road, by jakub rozalski, dark sunset lighting, elegant, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
302
- "blurry, poorly rendered, low quality, disfigured",
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
- "Abstract decorative illustration, by joan miro and gustav klimt and marlina vera and loish, elegant, intricate, highly detailed, smooth, sharp focus, vibrant colors, artstation, stunning masterpiece",
314
- "Abstract decorative illustration, by joan miro and gustav klimt and marlina vera and loish, elegant, intricate, highly detailed, smooth, sharp focus, vibrant colors, artstation, stunning masterpiece",
315
- "Abstract decorative illustration, by joan miro and gustav klimt and marlina vera and loish, elegant, intricate, highly detailed, smooth, sharp focus, vibrant colors, artstation, stunning masterpiece",
316
- "text, watermark, signature, distorted",
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
- "Magical diagrams and runes written with chalk on a blackboard, elegant, intricate, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
328
- "Magical diagrams and runes written with chalk on a blackboard, elegant, intricate, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
329
- "Magical diagrams and runes written with chalk on a blackboard, elegant, intricate, highly detailed, smooth, sharp focus, artstation, stunning masterpiece",
330
- "low quality, artifact, deformed, sketchy",
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,