Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,19 +49,19 @@ except ImportError:
|
|
| 49 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 50 |
# Constants
|
| 51 |
# ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 52 |
-
#
|
| 53 |
-
#
|
| 54 |
-
BG_COLOR = "#
|
| 55 |
-
SURFACE = "#
|
| 56 |
-
GRID_COLOR = "#
|
| 57 |
-
TEXT_COLOR = "#
|
| 58 |
-
TEXT_MUTED = "#
|
| 59 |
-
ACCENT = "#
|
| 60 |
-
ACCENT_HOVER = "#
|
| 61 |
-
SECONDARY = "#
|
| 62 |
-
SUCCESS = "#
|
| 63 |
-
WARNING = "#
|
| 64 |
-
ERROR = "#
|
| 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 = "
|
| 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: #
|
| 537 |
font-family: 'DM Sans', sans-serif !important;
|
| 538 |
-
color: #
|
| 539 |
}
|
| 540 |
h1, h2, h3, h4 {
|
| 541 |
font-family: 'Nunito Sans', sans-serif !important;
|
| 542 |
-
color: #
|
| 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: #
|
| 550 |
}
|
| 551 |
-
p, .prose, .markdown-body { color: #
|
| 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 β
|
| 570 |
.gr-panel, .gr-box, .gr-form, .tabitem, .block,
|
| 571 |
div[class*="svelte"].block, .form, .wrap.svelte-1ipelgc {
|
| 572 |
-
background: #
|
| 573 |
-
border: 1px solid #
|
| 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: #
|
| 582 |
-
color: #
|
| 583 |
-
border-color: #
|
| 584 |
border-radius: 4px !important;
|
| 585 |
}
|
| 586 |
|
| 587 |
/* Markdown / table content inside panels */
|
| 588 |
-
table, th, td { color: #
|
| 589 |
-
th { background: #
|
| 590 |
-
tr:nth-child(even) td { background: #
|
| 591 |
-
blockquote { background: #
|
| 592 |
-
code { background: #
|
| 593 |
|
| 594 |
-
/* Buttons β
|
| 595 |
.gr-button, button.primary {
|
| 596 |
-
background: #
|
| 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: #
|
| 607 |
}
|
| 608 |
|
| 609 |
-
/* Tabs β
|
| 610 |
.tab-nav button.selected {
|
| 611 |
-
color: #
|
| 612 |
-
border-color: #
|
| 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 β
|
| 642 |
-
body_background_fill="#
|
| 643 |
-
body_background_fill_dark="#
|
| 644 |
-
background_fill_primary="#
|
| 645 |
-
background_fill_primary_dark="#
|
| 646 |
-
background_fill_secondary="#
|
| 647 |
-
background_fill_secondary_dark="#
|
| 648 |
-
border_color_primary="#
|
| 649 |
-
border_color_primary_dark="#
|
| 650 |
-
block_background_fill="#
|
| 651 |
-
block_background_fill_dark="#
|
| 652 |
-
block_border_color="#
|
| 653 |
-
block_border_color_dark="#
|
| 654 |
-
block_label_background_fill="#
|
| 655 |
-
block_label_text_color="#
|
| 656 |
-
block_title_text_color="#
|
| 657 |
-
body_text_color="#
|
| 658 |
-
body_text_color_dark="#
|
| 659 |
-
body_text_color_subdued="#
|
| 660 |
-
input_background_fill="#
|
| 661 |
-
input_background_fill_dark="#
|
| 662 |
-
input_border_color="#
|
| 663 |
-
button_primary_background_fill="#
|
| 664 |
-
button_primary_background_fill_hover="#
|
| 665 |
button_primary_text_color="#FFFFFF",
|
| 666 |
-
button_secondary_background_fill="#
|
| 667 |
-
button_secondary_text_color="#
|
| 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("""
|