Antuke commited on
Commit
2c09904
·
1 Parent(s): 73f8599

fix dark mode

Browse files
Files changed (1) hide show
  1. app.py +11 -6
app.py CHANGED
@@ -361,13 +361,17 @@ def process_image(image, selected_checkpoint_path):
361
  results_html = f"""
362
  <style>
363
  :root {{
 
364
  --primary-color: #4f46e5;
365
  --success-color: #10b981;
366
- --text-primary: #ffffff;
367
- --text-secondary: #9ca3af;
368
- --background-dark: #1f2937;
369
- --background-darker: #111827;
370
- --border-color: #374151;
 
 
 
371
  }}
372
  .results-container {{
373
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
@@ -627,7 +631,8 @@ def create_interface(checkpoint_list, default_checkpoint, initial_status):
627
  """
628
 
629
  # Create interface
630
- with gr.Blocks(css=custom_css, title="Face Classification System") as demo:
 
631
 
632
  with gr.Row():
633
  gr.Markdown("# Face Classification System")
 
361
  results_html = f"""
362
  <style>
363
  :root {{
364
+ /* Your custom accent colors are fine */
365
  --primary-color: #4f46e5;
366
  --success-color: #10b981;
367
+
368
+ /* --- FIX: Use Gradio's theme variables --- */
369
+ /* This makes your component light/dark mode aware */
370
+ --text-primary: var(--body-text-color);
371
+ --text-secondary: var(--body-text-color-subdued);
372
+ --background-dark: var(--background-fill-primary);
373
+ --background-darker: var(--background-fill-secondary);
374
+ --border-color: var(--border-color-primary);
375
  }}
376
  .results-container {{
377
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
 
631
  """
632
 
633
  # Create interface
634
+ # --- FIX: Added theme=gr.themes.Default() to enable light/dark mode switching ---
635
+ with gr.Blocks(css=custom_css, title="Face Classification System", theme=gr.themes.Default()) as demo:
636
 
637
  with gr.Row():
638
  gr.Markdown("# Face Classification System")