AppleSwing commited on
Commit
6b098b9
·
verified ·
1 Parent(s): 66eea76

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +96 -56
app.py CHANGED
@@ -401,95 +401,135 @@ def parse_and_generate_plot(df_data: list, indices_str: str):
401
 
402
  def build_app() -> gr.Blocks:
403
  row_css = """
404
- /* General Body */
405
- body { background-color: #f5f7fa !important; }
406
- .gradio-container { max-width: 100% !important; padding: 20px !important; background-color: #f5f7fa !important; }
407
 
408
- /* Headers and Text */
409
- .gradio-container h1 { color: #24292e !important; font-weight: 700; margin-bottom: 24px; }
410
- .gradio-container h3 { color: #24292e !important; font-weight: 600; margin-bottom: 16px; }
411
- .gradio-container label, .gradio-container p, .gradio-container span, .gradio-container div { color: #24292e !important; }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
412
 
413
- /* Input Fields & Blocks */
414
- .gradio-container .block, .gradio-container .form, .gradio-container .gr-box, .gradio-container .gr-input {
415
- background-color: white !important; border-color: #e1e4e8 !important;
 
 
416
  }
417
- .gradio-container input[type="checkbox"] { accent-color: #0366d6 !important; }
 
 
 
 
 
 
 
 
418
 
419
- /* Search Box Styling */
420
  .search-box {
421
  background: white !important; padding: 16px !important;
422
  border-radius: 6px; border: 2px solid #e1e4e8 !important;
423
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); margin-bottom: 16px;
424
  }
425
- .search-box .block { background: transparent !important; border: none !important; padding: 0 !important; }
426
- .search-box label span { color: #24292e !important; font-weight: 600; font-size: 14px; margin-bottom: 8px; }
427
- .search-box input.scroll-hide {
428
- background-color: white !important; color: #24292e !important;
429
- border: 1.5px solid #e1e4e8 !important; border-radius: 4px !important;
430
- padding: 10px !important; box-shadow: none !important;
431
- }
432
- .search-box input.scroll-hide:focus { border-color: #0366d6 !important; outline: none !important; }
433
-
434
- /* Filter Section Styling */
435
- .filter-section {
436
- background: white !important; padding: 0 !important; border-radius: 6px;
437
- border: 2px solid #e1e4e8 !important; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
438
- }
439
- .filter-section .wrap, .filter-section .block, .filter-section .container, .filter-section .group { background: transparent !important; }
440
- .filter-section .wrap { padding: 20px !important; }
441
 
442
- /* ACCORDION STYLING */
443
- .gradio-container .accordion {
444
- background: white !important; border: 2px solid #e1e4e8 !important;
445
- border-radius: 6px !important; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
 
 
446
  }
447
- .info-section { padding: 16px; background: white !important; }
448
- .info-section a { color: #0366d6 !important; }
449
-
450
- /* --- FIX FOR DARK MODE / NIGHT MODE --- */
451
- /* This forces the accordion button text and icons to stay dark */
452
- .gradio-container .accordion button,
453
  .gradio-container .accordion span {
 
454
  color: #24292e !important;
455
  }
456
- /* This forces the expand arrow to be dark */
457
  .gradio-container .accordion svg {
458
- fill: #24292e !important;
459
- color: #24292e !important;
460
  }
461
- /* --------------------------------------- */
462
 
463
- /* Table Container & Plot */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
464
  .table-container {
465
  overflow-x: auto; overflow-y: auto; max-height: 75vh;
466
  border: 2px solid #e1e4e8; border-radius: 6px;
467
  background: white; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
468
  }
469
- .gradio-container .plot-container { width: 100% !important; }
470
 
471
- /* Table Internal Styling */
472
- .gradio-container table.metrics-table { border-collapse: collapse; width: 100%; background: white; }
473
- .gradio-container table.metrics-table th, .gradio-container table.metrics-table td {
474
- padding: 10px 14px; border: 1.5px solid #e1e4e8; white-space: nowrap;
475
- font-size: 13px; text-align: left; color: #24292e !important;
 
 
 
 
 
 
 
 
476
  }
 
477
  .gradio-container table.metrics-table th {
478
- background: linear-gradient(to bottom, #fafbfc, #f6f8fa);
479
  font-weight: 600; position: sticky; top: 0; z-index: 10;
480
  border-bottom: 2px solid #d1d5da;
481
  }
482
- .gradio-container table.metrics-table tbody tr:nth-child(even) { background-color: #f6f8fa; }
483
- .gradio-container table.metrics-table tbody tr:hover { background-color: #e1e4e8; }
484
- .gradio-container table.metrics-table a { color: #0366d6 !important; text-decoration: none; }
485
- .gradio-container table.metrics-table a:hover { text-decoration: underline; }
486
 
487
- /* Row number column styling */
488
  .metrics-table th:first-child, .metrics-table td:first-child {
489
  width: 60px !important; text-align: center !important;
490
- padding: 8px !important; font-weight: 600 !important;
491
  background-color: #f0f0f0 !important;
492
  }
 
 
 
493
  """
494
 
495
  with gr.Blocks(title="MoE-CAP Dashboard", css=row_css, theme=gr.themes.Default()) as demo:
 
401
 
402
  def build_app() -> gr.Blocks:
403
  row_css = """
404
+ /* ============================================================ */
405
+ /* GLOBAL RESET: Force Light Mode Colors Everywhere */
406
+ /* ============================================================ */
407
 
408
+ /* 1. Main Backgrounds */
409
+ body, .gradio-container {
410
+ background-color: #f5f7fa !important;
411
+ }
412
+
413
+ /* 2. Force ALL Text to be Dark (overrides Dark Mode white text) */
414
+ .gradio-container,
415
+ .gradio-container p,
416
+ .gradio-container h1, .gradio-container h2, .gradio-container h3,
417
+ .gradio-container span,
418
+ .gradio-container label,
419
+ .gradio-container div,
420
+ .gradio-container .prose,
421
+ .gradio-container .prose * {
422
+ color: #24292e !important;
423
+ }
424
+
425
+ /* 3. Force Inputs (Search box) to be White with Dark Text */
426
+ .gradio-container input,
427
+ .gradio-container textarea,
428
+ .gradio-container select {
429
+ background-color: #ffffff !important;
430
+ color: #24292e !important;
431
+ border-color: #e1e4e8 !important;
432
+ }
433
+
434
+ /* 4. Fix Checkbox Groups (The dark rectangles in your screenshot) */
435
+ .gradio-container .wrap.default,
436
+ .gradio-container .block {
437
+ background-color: transparent !important; /* Removes blocky grey backgrounds */
438
+ }
439
 
440
+ /* The individual checkboxes */
441
+ .gradio-container label.svelte-1b8605,
442
+ .gradio-container label {
443
+ background-color: white !important;
444
+ border-color: #e1e4e8 !important;
445
  }
446
+
447
+ /* Force checkbox text to be visible */
448
+ .gradio-container label span {
449
+ color: #24292e !important;
450
+ }
451
+
452
+ /* ============================================================ */
453
+ /* COMPONENT SPECIFIC STYLING */
454
+ /* ============================================================ */
455
 
456
+ /* Search Box Container */
457
  .search-box {
458
  background: white !important; padding: 16px !important;
459
  border-radius: 6px; border: 2px solid #e1e4e8 !important;
460
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06); margin-bottom: 16px;
461
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
462
 
463
+ /* Filter Section & Accordion Container */
464
+ .filter-section, .gradio-container .accordion {
465
+ background: white !important;
466
+ border: 2px solid #e1e4e8 !important;
467
+ border-radius: 6px !important;
468
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
469
  }
470
+
471
+ /* Accordion Header - Fix for Day/Night button colors */
472
+ .gradio-container .accordion button,
 
 
 
473
  .gradio-container .accordion span {
474
+ background-color: white !important;
475
  color: #24292e !important;
476
  }
 
477
  .gradio-container .accordion svg {
478
+ fill: #24292e !important; /* Arrows */
 
479
  }
 
480
 
481
+ /* Info Section (The invisible text area) */
482
+ .info-section { padding: 16px; background: white !important; }
483
+
484
+ /* Links should remain Blue */
485
+ .gradio-container a, .gradio-container .prose a {
486
+ color: #0366d6 !important;
487
+ text-decoration: none;
488
+ }
489
+ .gradio-container a:hover { text-decoration: underline; }
490
+
491
+ /* Checkbox Accent Color */
492
+ .gradio-container input[type="checkbox"] { accent-color: #0366d6 !important; }
493
+
494
+ /* ============================================================ */
495
+ /* TABLE STYLING */
496
+ /* ============================================================ */
497
+
498
  .table-container {
499
  overflow-x: auto; overflow-y: auto; max-height: 75vh;
500
  border: 2px solid #e1e4e8; border-radius: 6px;
501
  background: white; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
502
  }
 
503
 
504
+ .gradio-container table.metrics-table {
505
+ border-collapse: collapse; width: 100%; background: white !important;
506
+ }
507
+
508
+ .gradio-container table.metrics-table th,
509
+ .gradio-container table.metrics-table td {
510
+ padding: 10px 14px;
511
+ border: 1.5px solid #e1e4e8;
512
+ white-space: nowrap;
513
+ font-size: 13px;
514
+ text-align: left;
515
+ background-color: white !important;
516
+ color: #24292e !important;
517
  }
518
+
519
  .gradio-container table.metrics-table th {
520
+ background: #f6f8fa !important; /* Light grey header */
521
  font-weight: 600; position: sticky; top: 0; z-index: 10;
522
  border-bottom: 2px solid #d1d5da;
523
  }
 
 
 
 
524
 
525
+ /* Row Number Column */
526
  .metrics-table th:first-child, .metrics-table td:first-child {
527
  width: 60px !important; text-align: center !important;
 
528
  background-color: #f0f0f0 !important;
529
  }
530
+
531
+ /* Plot Container */
532
+ .gradio-container .plot-container { width: 100% !important; }
533
  """
534
 
535
  with gr.Blocks(title="MoE-CAP Dashboard", css=row_css, theme=gr.themes.Default()) as demo: