WasuratS commited on
Commit
310be01
Β·
verified Β·
1 Parent(s): 013d1a6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +63 -63
app.py CHANGED
@@ -49,19 +49,19 @@ except ImportError:
49
  # ──────────────────────────────────────────────────────────────────────────────
50
  # Constants
51
  # ──────────────────────────────────────────────────────────────────────────────
52
- # Tidepool Sorbet palette β€” fresh, sunny, welcoming
53
- # Coral #ff7a7a Β· Apricot #ffa36c Β· Butter #fff1b6 Β· Mint #7ae7c7 Β· Deep Teal #1f6f78
54
- BG_COLOR = "#FFF1B6" # Pale Butter Yellow β€” page & figure background
55
- SURFACE = "#FFFDF6" # warm near-white β€” card / plot-axis surface (pops against butter)
56
- GRID_COLOR = "#F2CE8A" # deeper butter β€” dividers, plot grid & borders
57
- TEXT_COLOR = "#1F6F78" # Deep Teal β€” headings & primary text
58
- TEXT_MUTED = "#4F8B91" # softened teal β€” secondary text
59
- ACCENT = "#FF7A7A" # Coral β€” primary CTA / plot highlights
60
- ACCENT_HOVER = "#E85F5F" # darker coral β€” hover/pressed state
61
- SECONDARY = "#FFA36C" # Apricot β€” secondary highlight (pairs with coral)
62
- SUCCESS = "#1F9D86" # deep mint/teal β€” positive / biotic indicator
63
- WARNING = "#7AE7C7" # Mint β€” fresh accent (diversity indicator)
64
- ERROR = "#E2483F" # deep coral-red β€” errors / negative indicator
65
  N_FFT = 2048
66
  HOP = 512
67
  MAX_DUR_S = 300 # clip to 5 min for HuggingFace timeout safety
@@ -230,7 +230,7 @@ def analyze(file_path):
230
  mel_db = librosa.power_to_db(mel_spec, ref=np.max)
231
 
232
  fig2, axes2 = _make_fig(3, 1, figsize=(13, 11))
233
- CMAP = "magma"
234
  VRANGE = dict(vmin=-80, vmax=0)
235
 
236
  # Linear
@@ -533,22 +533,22 @@ CSS = """
533
  @import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');
534
 
535
  body, .gradio-container {
536
- background: #FFF1B6 !important;
537
  font-family: 'DM Sans', sans-serif !important;
538
- color: #1F6F78 !important;
539
  }
540
  h1, h2, h3, h4 {
541
  font-family: 'Nunito Sans', sans-serif !important;
542
- color: #1F6F78 !important;
543
  }
544
  h1 { font-size: 2.2rem !important; font-weight: 800 !important; }
545
  h2, h3 { font-weight: 700 !important; }
546
  label, .tab-nav button {
547
  font-family: 'DM Sans', sans-serif !important;
548
  font-weight: 600 !important;
549
- color: #1F6F78 !important;
550
  }
551
- p, .prose, .markdown-body { color: #4F8B91 !important; }
552
 
553
  /* Reduce Gradio's default rounded-corner look across every component
554
  (blocks, inputs, buttons, tabs, dropdowns, audio player, etc.) by
@@ -566,34 +566,34 @@ p, .prose, .markdown-body { color: #4F8B91 !important; }
566
  --table-radius: 4px !important;
567
  }
568
 
569
- /* Cards / surfaces β€” warm near-white, popping against the butter page background */
570
  .gr-panel, .gr-box, .gr-form, .tabitem, .block,
571
  div[class*="svelte"].block, .form, .wrap.svelte-1ipelgc {
572
- background: #FFFDF6 !important;
573
- border: 1px solid #F2CE8A !important;
574
  border-radius: 4px !important;
575
  }
576
 
577
- /* Force every input / upload / textbox surface off pure white */
578
  input, textarea, select,
579
  .gr-input, .gr-box textarea, .gr-box input,
580
  .upload-box, .upload-container, [data-testid="audio"] {
581
- background: #FFFDF6 !important;
582
- color: #1F6F78 !important;
583
- border-color: #F2CE8A !important;
584
  border-radius: 4px !important;
585
  }
586
 
587
  /* Markdown / table content inside panels */
588
- table, th, td { color: #1F6F78 !important; border-color: #F2CE8A !important; }
589
- th { background: #FFA36C !important; color: #1F6F78 !important; }
590
- tr:nth-child(even) td { background: #FFF7DE !important; }
591
- blockquote { background: #FFE9A8 !important; border-left: 4px solid #FF7A7A !important; color: #1F6F78 !important; }
592
- code { background: #FFE9A8 !important; color: #1F6F78 !important; }
593
 
594
- /* Buttons β€” Tidepool Sorbet coral primary */
595
  .gr-button, button.primary {
596
- background: #FF7A7A !important;
597
  border: none !important;
598
  color: #FFFFFF !important;
599
  font-weight: 700;
@@ -603,13 +603,13 @@ code { background: #FFE9A8 !important; color: #1F6F78 !important; }
603
  transition: background 0.15s ease-in-out;
604
  }
605
  .gr-button:hover, button.primary:hover {
606
- background: #E85F5F !important;
607
  }
608
 
609
- /* Tabs β€” coral active state */
610
  .tab-nav button.selected {
611
- color: #FF7A7A !important;
612
- border-color: #FF7A7A !important;
613
  }
614
 
615
  footer { display: none !important; }
@@ -638,33 +638,33 @@ with gr.Blocks(title="🌊 Marine Soundscape Analyzer", css=CSS,
638
  ).set(
639
  # Drive every component's box color through real theme tokens
640
  # (more reliable than CSS class guessing) so nothing renders
641
- # on plain white β€” Tidepool Sorbet palette throughout.
642
- body_background_fill="#FFF1B6",
643
- body_background_fill_dark="#FFF1B6",
644
- background_fill_primary="#FFFDF6",
645
- background_fill_primary_dark="#FFFDF6",
646
- background_fill_secondary="#FFE9A8",
647
- background_fill_secondary_dark="#FFE9A8",
648
- border_color_primary="#F2CE8A",
649
- border_color_primary_dark="#F2CE8A",
650
- block_background_fill="#FFFDF6",
651
- block_background_fill_dark="#FFFDF6",
652
- block_border_color="#F2CE8A",
653
- block_border_color_dark="#F2CE8A",
654
- block_label_background_fill="#FFA36C",
655
- block_label_text_color="#1F6F78",
656
- block_title_text_color="#1F6F78",
657
- body_text_color="#1F6F78",
658
- body_text_color_dark="#1F6F78",
659
- body_text_color_subdued="#4F8B91",
660
- input_background_fill="#FFFDF6",
661
- input_background_fill_dark="#FFFDF6",
662
- input_border_color="#F2CE8A",
663
- button_primary_background_fill="#FF7A7A",
664
- button_primary_background_fill_hover="#E85F5F",
665
  button_primary_text_color="#FFFFFF",
666
- button_secondary_background_fill="#7AE7C7",
667
- button_secondary_text_color="#1F6F78",
668
  )) as demo:
669
 
670
  gr.Markdown("""
 
49
  # ──────────────────────────────────────────────────────────────────────────────
50
  # Constants
51
  # ──────────────────────────────────────────────────────────────────────────────
52
+ # Coral Reef Lagoon palette β€” deep ocean water with living-coral & seafoam pops
53
+ # Deep Ocean #0b3d4a Β· Lagoon #1a5c6b Β· Coral #ff6f59 Β· Seafoam #4cd9c0 Β· Sandy Gold #ffc857
54
+ BG_COLOR = "#0B3D4A" # Deep Ocean Teal β€” page & figure background
55
+ SURFACE = "#123F4D" # Lagoon Teal β€” card / plot-axis surface (pops against deep ocean)
56
+ GRID_COLOR = "#2A7A85" # Reef Teal β€” dividers, plot grid & borders
57
+ TEXT_COLOR = "#E7FBFF" # Sea Foam White β€” headings & primary text
58
+ TEXT_MUTED = "#8FD9E0" # soft aqua β€” secondary text
59
+ ACCENT = "#FF6F59" # Living Coral β€” primary CTA / plot highlights
60
+ ACCENT_HOVER = "#E5563F" # deeper coral β€” hover/pressed state
61
+ SECONDARY = "#4CD9C0" # Seafoam Turquoise β€” secondary highlight (pairs with coral)
62
+ SUCCESS = "#3ADC91" # sea-green β€” positive / biotic indicator
63
+ WARNING = "#FFC857" # Sandy Gold β€” fresh accent (diversity indicator)
64
+ ERROR = "#FF5C5C" # vivid coral-red β€” errors / negative indicator
65
  N_FFT = 2048
66
  HOP = 512
67
  MAX_DUR_S = 300 # clip to 5 min for HuggingFace timeout safety
 
230
  mel_db = librosa.power_to_db(mel_spec, ref=np.max)
231
 
232
  fig2, axes2 = _make_fig(3, 1, figsize=(13, 11))
233
+ CMAP = "GnBu_r"
234
  VRANGE = dict(vmin=-80, vmax=0)
235
 
236
  # Linear
 
533
  @import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:wght@400;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');
534
 
535
  body, .gradio-container {
536
+ background: linear-gradient(180deg, #04222C 0%, #0B3D4A 45%, #123F4D 100%) !important;
537
  font-family: 'DM Sans', sans-serif !important;
538
+ color: #E7FBFF !important;
539
  }
540
  h1, h2, h3, h4 {
541
  font-family: 'Nunito Sans', sans-serif !important;
542
+ color: #4CD9C0 !important;
543
  }
544
  h1 { font-size: 2.2rem !important; font-weight: 800 !important; }
545
  h2, h3 { font-weight: 700 !important; }
546
  label, .tab-nav button {
547
  font-family: 'DM Sans', sans-serif !important;
548
  font-weight: 600 !important;
549
+ color: #E7FBFF !important;
550
  }
551
+ p, .prose, .markdown-body { color: #8FD9E0 !important; }
552
 
553
  /* Reduce Gradio's default rounded-corner look across every component
554
  (blocks, inputs, buttons, tabs, dropdowns, audio player, etc.) by
 
566
  --table-radius: 4px !important;
567
  }
568
 
569
+ /* Cards / surfaces β€” lagoon teal, popping against the deep-ocean page background */
570
  .gr-panel, .gr-box, .gr-form, .tabitem, .block,
571
  div[class*="svelte"].block, .form, .wrap.svelte-1ipelgc {
572
+ background: #123F4D !important;
573
+ border: 1px solid #2A7A85 !important;
574
  border-radius: 4px !important;
575
  }
576
 
577
+ /* Force every input / upload / textbox surface off pure white, into lagoon teal */
578
  input, textarea, select,
579
  .gr-input, .gr-box textarea, .gr-box input,
580
  .upload-box, .upload-container, [data-testid="audio"] {
581
+ background: #15505E !important;
582
+ color: #E7FBFF !important;
583
+ border-color: #2A7A85 !important;
584
  border-radius: 4px !important;
585
  }
586
 
587
  /* Markdown / table content inside panels */
588
+ table, th, td { color: #E7FBFF !important; border-color: #2A7A85 !important; }
589
+ th { background: #FF6F59 !important; color: #FFFFFF !important; }
590
+ tr:nth-child(even) td { background: #1A5C6B !important; }
591
+ blockquote { background: #15505E !important; border-left: 4px solid #FF6F59 !important; color: #E7FBFF !important; }
592
+ code { background: #15505E !important; color: #4CD9C0 !important; }
593
 
594
+ /* Buttons β€” Coral Reef Lagoon living-coral primary */
595
  .gr-button, button.primary {
596
+ background: #FF6F59 !important;
597
  border: none !important;
598
  color: #FFFFFF !important;
599
  font-weight: 700;
 
603
  transition: background 0.15s ease-in-out;
604
  }
605
  .gr-button:hover, button.primary:hover {
606
+ background: #E5563F !important;
607
  }
608
 
609
+ /* Tabs β€” seafoam turquoise active state */
610
  .tab-nav button.selected {
611
+ color: #4CD9C0 !important;
612
+ border-color: #4CD9C0 !important;
613
  }
614
 
615
  footer { display: none !important; }
 
638
  ).set(
639
  # Drive every component's box color through real theme tokens
640
  # (more reliable than CSS class guessing) so nothing renders
641
+ # on plain white β€” Coral Reef Lagoon palette throughout.
642
+ body_background_fill="#0B3D4A",
643
+ body_background_fill_dark="#0B3D4A",
644
+ background_fill_primary="#123F4D",
645
+ background_fill_primary_dark="#123F4D",
646
+ background_fill_secondary="#15505E",
647
+ background_fill_secondary_dark="#15505E",
648
+ border_color_primary="#2A7A85",
649
+ border_color_primary_dark="#2A7A85",
650
+ block_background_fill="#123F4D",
651
+ block_background_fill_dark="#123F4D",
652
+ block_border_color="#2A7A85",
653
+ block_border_color_dark="#2A7A85",
654
+ block_label_background_fill="#FF6F59",
655
+ block_label_text_color="#FFFFFF",
656
+ block_title_text_color="#4CD9C0",
657
+ body_text_color="#E7FBFF",
658
+ body_text_color_dark="#E7FBFF",
659
+ body_text_color_subdued="#8FD9E0",
660
+ input_background_fill="#15505E",
661
+ input_background_fill_dark="#15505E",
662
+ input_border_color="#2A7A85",
663
+ button_primary_background_fill="#FF6F59",
664
+ button_primary_background_fill_hover="#E5563F",
665
  button_primary_text_color="#FFFFFF",
666
+ button_secondary_background_fill="#4CD9C0",
667
+ button_secondary_text_color="#0B3D4A",
668
  )) as demo:
669
 
670
  gr.Markdown("""