bbqhan commited on
Commit
f34d937
·
verified ·
1 Parent(s): adcf3f2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +98 -31
app.py CHANGED
@@ -250,31 +250,81 @@ def upscale_image(image_path, seed=666, cfg_scale=1.0):
250
 
251
  # Custom CSS for the "Top Tier" look
252
  custom_css = """
 
253
  .gradio-container {
254
- font-family: 'Inter', sans-serif;
255
  }
 
 
256
  h1 {
257
  text-align: center;
258
  color: #FF7043;
259
- font-weight: 800;
 
 
260
  }
261
- .contain {
262
- background-color: #FAFAFA;
 
 
 
263
  }
 
 
264
  button.primary {
265
- background: linear-gradient(45deg, #FF7043, #FFAB91);
266
- border: none;
267
- box-shadow: 0 4px 15px rgba(255, 112, 67, 0.3);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
268
  }
269
  """
270
 
271
- # Fixed theme radius size
272
  theme = gr.themes.Soft(
273
  primary_hue="orange",
274
- secondary_hue="slate",
275
- neutral_hue="stone",
276
- radius_size="lg", # Changed from gr.themes.sizes.RADIUS_LG to string literal "lg"
 
277
  ).set(
 
 
 
 
 
 
 
 
 
 
 
 
278
  button_primary_background_fill="#FF7043",
279
  button_primary_background_fill_hover="#F4511E",
280
  button_primary_text_color="white",
@@ -282,7 +332,7 @@ theme = gr.themes.Soft(
282
 
283
  with gr.Blocks(theme=theme, css=custom_css, title="SeedVR2 Image Upscaler") as demo:
284
 
285
- with gr.Column(variant="panel"):
286
  gr.Markdown(
287
  """
288
  # 🍊 SeedVR2 Image Upscaler
@@ -291,23 +341,38 @@ with gr.Blocks(theme=theme, css=custom_css, title="SeedVR2 Image Upscaler") as d
291
  )
292
 
293
  with gr.Row(equal_height=True):
294
- with gr.Column(scale=1):
 
 
 
 
 
 
 
 
 
 
 
295
  with gr.Group():
296
- input_image = gr.Image(
297
- label="Input Image",
298
- type="filepath",
299
- height=400,
300
- sources=["upload", "clipboard"]
301
- )
302
- with gr.Accordion("Advanced Settings", open=False):
303
- seed_input = gr.Number(label="Seed", value=666, precision=0)
304
- cfg_input = gr.Slider(label="CFG Scale", minimum=0.0, maximum=10.0, value=1.0, step=0.1)
305
-
306
- run_btn = gr.Button("✨ Upscale Image", variant="primary", size="lg")
307
-
308
- with gr.Column(scale=1):
309
- output_image = gr.Image(label="Restored Result", interactive=False, height=400)
310
- download_file = gr.File(label="Download High-Res")
 
 
 
 
311
 
312
  run_btn.click(
313
  fn=upscale_image,
@@ -315,10 +380,12 @@ with gr.Blocks(theme=theme, css=custom_css, title="SeedVR2 Image Upscaler") as d
315
  outputs=[output_image, download_file]
316
  )
317
 
318
- gr.Markdown(
 
319
  """
320
- <div style="text-align: center; opacity: 0.6; margin-top: 20px; font-size: 0.8em;">
321
- Powered by SeedVR2 | One-Step Diffusion Model
 
322
  </div>
323
  """
324
  )
 
250
 
251
  # Custom CSS for the "Top Tier" look
252
  custom_css = """
253
+ /* Font Import handled by Theme, but custom tweaks here */
254
  .gradio-container {
255
+ font-family: 'IBM Plex Sans', sans-serif !important;
256
  }
257
+
258
+ /* Header Styling */
259
  h1 {
260
  text-align: center;
261
  color: #FF7043;
262
+ font-weight: 700 !important;
263
+ font-size: 2.5rem !important;
264
+ margin-bottom: 0.5rem !important;
265
  }
266
+ h3 {
267
+ text-align: center;
268
+ color: #525252;
269
+ font-weight: 400 !important;
270
+ margin-top: 0 !important;
271
  }
272
+
273
+ /* Button Styling - Vibrant Orange */
274
  button.primary {
275
+ background: linear-gradient(135deg, #FF7043 0%, #FF5722 100%) !important;
276
+ border: none !important;
277
+ box-shadow: 0 4px 6px -1px rgba(255, 87, 34, 0.2), 0 2px 4px -1px rgba(255, 87, 34, 0.1) !important;
278
+ transition: all 0.2s ease !important;
279
+ }
280
+ button.primary:hover {
281
+ transform: translateY(-1px);
282
+ box-shadow: 0 10px 15px -3px rgba(255, 87, 34, 0.3), 0 4px 6px -2px rgba(255, 87, 34, 0.15) !important;
283
+ }
284
+
285
+ /* UI Boxes (Groups/Columns) */
286
+ .ui-box {
287
+ background: white;
288
+ border: 1px solid #E5E7EB;
289
+ border-radius: 12px;
290
+ padding: 20px;
291
+ box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
292
+ height: 100%;
293
+ display: flex;
294
+ flex-direction: column;
295
+ }
296
+
297
+ /* Footer Styling */
298
+ .footer-link {
299
+ color: #FF7043;
300
+ text-decoration: none;
301
+ font-weight: 600;
302
+ }
303
+ .footer-link:hover {
304
+ text-decoration: underline;
305
  }
306
  """
307
 
308
+ # Refined Theme
309
  theme = gr.themes.Soft(
310
  primary_hue="orange",
311
+ secondary_hue="zinc",
312
+ neutral_hue="slate",
313
+ font=[gr.themes.GoogleFont("IBM Plex Sans"), "ui-sans-serif", "system-ui", "sans-serif"],
314
+ radius_size="lg",
315
  ).set(
316
+ body_background_fill="#F9FAFB",
317
+ block_background_fill="white",
318
+ block_border_width="0px", # Clean look
319
+ block_shadow="none",
320
+ # Remove orange background from labels
321
+ block_label_background_fill="transparent",
322
+ block_label_text_color="#4B5563",
323
+ block_label_text_weight="600",
324
+ block_title_text_color="#1F2937",
325
+ # Input/Output styling
326
+ input_background_fill="#F3F4F6",
327
+ # Primary Button (Orange)
328
  button_primary_background_fill="#FF7043",
329
  button_primary_background_fill_hover="#F4511E",
330
  button_primary_text_color="white",
 
332
 
333
  with gr.Blocks(theme=theme, css=custom_css, title="SeedVR2 Image Upscaler") as demo:
334
 
335
+ with gr.Column():
336
  gr.Markdown(
337
  """
338
  # 🍊 SeedVR2 Image Upscaler
 
341
  )
342
 
343
  with gr.Row(equal_height=True):
344
+ # Left Column: Input
345
+ with gr.Column(scale=1, elem_classes="ui-box"):
346
+ gr.Markdown("#### Source", elem_id="input-header")
347
+ input_image = gr.Image(
348
+ label="Input Image",
349
+ type="filepath",
350
+ height=400,
351
+ sources=["upload", "clipboard"],
352
+ show_label=False
353
+ )
354
+
355
+ gr.Markdown("#### Settings", elem_id="settings-header")
356
  with gr.Group():
357
+ with gr.Row():
358
+ seed_input = gr.Number(label="Seed", value=666, precision=0, container=True)
359
+ cfg_input = gr.Slider(label="CFG Scale", minimum=0.0, maximum=10.0, value=1.0, step=0.1, container=True)
360
+
361
+ # Spacer
362
+ gr.HTML("<div style='height: 20px;'></div>")
363
+
364
+ run_btn = gr.Button("Upscale Image", variant="primary", size="lg")
365
+
366
+ # Right Column: Output
367
+ with gr.Column(scale=1, elem_classes="ui-box"):
368
+ gr.Markdown("#### Result", elem_id="output-header")
369
+ output_image = gr.Image(
370
+ label="Restored Result",
371
+ interactive=False,
372
+ height=400,
373
+ show_label=False
374
+ )
375
+ download_file = gr.File(label="Download High-Res", container=False)
376
 
377
  run_btn.click(
378
  fn=upscale_image,
 
380
  outputs=[output_image, download_file]
381
  )
382
 
383
+ # Footer
384
+ gr.HTML(
385
  """
386
+ <div style="text-align: center; margin-top: 40px; margin-bottom: 20px; font-size: 0.9em; color: #6B7280;">
387
+ <p style="margin: 5px 0;">Powered by <b>SeedVR2</b> | One-Step Diffusion Model</p>
388
+ <p style="margin: 5px 0;">UI/UX by <a href="https://huggingface.co/bbqhan" target="_blank" class="footer-link">@bbqhan</a></p>
389
  </div>
390
  """
391
  )