Spaces:
Sleeping
Sleeping
Giorgio Strano commited on
Commit ·
a44cd6c
1
Parent(s): 680dd5a
first commit
Browse files- .gitattributes +1 -0
- .gitignore +1 -0
- gradio.py +51 -0
- styles.css +175 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
audio/ filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
audio/
|
gradio.py
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
|
| 4 |
+
# Sample data for the demo
|
| 5 |
+
samples = {"drums": [], "bass": []}
|
| 6 |
+
|
| 7 |
+
audio_dir: Path = Path(__file__).parent / "audio"
|
| 8 |
+
bass_dir: Path = audio_dir / "bass"
|
| 9 |
+
drums_dir: Path = audio_dir / "drums"
|
| 10 |
+
|
| 11 |
+
for instrument in samples.keys():
|
| 12 |
+
for subdir in (audio_dir / instrument.lower()).iterdir():
|
| 13 |
+
context = str(sorted(list(subdir.glob("*context.wav")))[0])
|
| 14 |
+
gen = str(sorted(list(subdir.glob("*gen.wav")))[0])
|
| 15 |
+
mix = str(sorted(list(subdir.glob("*mix.wav")))[0])
|
| 16 |
+
samples[instrument].append({
|
| 17 |
+
"context": context,
|
| 18 |
+
"generated": gen,
|
| 19 |
+
"mix": mix
|
| 20 |
+
})
|
| 21 |
+
|
| 22 |
+
with gr.Blocks(theme=gr.themes.Soft(), css_paths=["styles.css"]) as demo:
|
| 23 |
+
# Header and description
|
| 24 |
+
gr.HTML("<h1>STAGE: demo samples</h1>")
|
| 25 |
+
gr.HTML('''
|
| 26 |
+
<div class="centered-text">
|
| 27 |
+
Listen to audio samples from STAGE, our <i>Single-stem Accompaniment Generation Model</i>.<br>
|
| 28 |
+
All generated samples are straight from the model, with no post-processing.<br>
|
| 29 |
+
All contexts are taken from an isolated test datset.
|
| 30 |
+
<br>
|
| 31 |
+
<a href="https://github.com/yourname/yourproject" target="_blank">GitHub</a> |
|
| 32 |
+
<a href="https://arxiv.org/abs/yourpaperid" target="_blank">arXiv</a>
|
| 33 |
+
</div>
|
| 34 |
+
''')
|
| 35 |
+
|
| 36 |
+
# Tabs for Bass and Drums samples
|
| 37 |
+
with gr.Tabs(elem_classes="tabs-container"):
|
| 38 |
+
|
| 39 |
+
for instrument in samples.keys():
|
| 40 |
+
|
| 41 |
+
with gr.Tab(instrument.capitalize(), elem_classes="tab-content"):
|
| 42 |
+
for i, s in enumerate(samples[instrument], 1):
|
| 43 |
+
with gr.Group(elem_classes="audio-section"):
|
| 44 |
+
gr.HTML(f"Sample {i}", elem_classes="sample-title")
|
| 45 |
+
with gr.Row(elem_classes="audio-row"):
|
| 46 |
+
for name, audiopath in s.items():
|
| 47 |
+
gr.Audio(audiopath,
|
| 48 |
+
label=name.capitalize(),
|
| 49 |
+
type="filepath",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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* styles.css */
|
| 2 |
+
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Noto+Serif:ital,wght@0,100..900;1,100..900&display=swap');
|
| 3 |
+
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Montserrat:ital,wght@0,100..900;1,100..900&family=Noto+Serif:ital,wght@0,100..900;1,100..900&family=Roboto+Mono:ital,wght@0,100..700;1,100..700&display=swap');
|
| 4 |
+
|
| 5 |
+
:root {
|
| 6 |
+
--bg-color: #0f0f0f;
|
| 7 |
+
/* --accent-color: #1b717d; */
|
| 8 |
+
--accent-color: #4f46e5;
|
| 9 |
+
/* --font-color: #ffffff; */
|
| 10 |
+
--font-color: #fbf8f5;
|
| 11 |
+
|
| 12 |
+
/* --bg-secondary: #374151 !important; */
|
| 13 |
+
/* --bg-secondary: #202627 !important; */
|
| 14 |
+
--bg-secondary: #3d3f4d !important;
|
| 15 |
+
|
| 16 |
+
/* --bg-tertiary: #304146 !important; */
|
| 17 |
+
--bg-tertiary: #232638 !important;
|
| 18 |
+
|
| 19 |
+
/* other stuff */
|
| 20 |
+
--primary: #1b717d !important;
|
| 21 |
+
--primary-hover: #1b717d !important;
|
| 22 |
+
--primary-pressed: #1b717d !important;
|
| 23 |
+
--secondary-400: #1b717d !important;
|
| 24 |
+
--secondary-500: #1b717d !important;
|
| 25 |
+
--secondary-600: #1b717d !important;
|
| 26 |
+
--secondary-700: #1b717d !important;
|
| 27 |
+
--secondary-800: #1b717d !important;
|
| 28 |
+
--secondary-900: #1b717d !important;
|
| 29 |
+
--link-text-color: #1b717d !important;
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
body, .gradio-container, .gr-block {
|
| 33 |
+
font-family: 'DM Serif Display', serif !important;
|
| 34 |
+
background-color: var(--bg-color);
|
| 35 |
+
color: var(--font-color) !important;
|
| 36 |
+
/* --color-accent-soft: var(--neutral-700) !important; */
|
| 37 |
+
/* --color-accent-soft: #ff0000 !important; */
|
| 38 |
+
/* --background-fill-secondary: var(--neutral-900); */
|
| 39 |
+
/* --background-fill-secondary: #ff0000 !important; */
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
strong {
|
| 43 |
+
color: inherit !important;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
a{
|
| 47 |
+
color: var(--accent-color);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/* Header styling */
|
| 51 |
+
h1 {
|
| 52 |
+
text-align: center;
|
| 53 |
+
font-size: 5em;
|
| 54 |
+
margin: 20px 0 10px !important;
|
| 55 |
+
font-weight: 700;
|
| 56 |
+
color: inherit;
|
| 57 |
+
/* color: #222 !important; */
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/* Description text */
|
| 61 |
+
.centered-text {
|
| 62 |
+
text-align: center !important;
|
| 63 |
+
margin-bottom: 24px !important;
|
| 64 |
+
font-size: 1.5em !important;
|
| 65 |
+
color: inherit;
|
| 66 |
+
/* color: #444 !important; */
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
/* Tabs container */
|
| 70 |
+
.tabs-container {
|
| 71 |
+
align:center;
|
| 72 |
+
text-align: center;
|
| 73 |
+
width: 1000px;
|
| 74 |
+
margin: 0 auto;
|
| 75 |
+
color: inherit;
|
| 76 |
+
}
|
| 77 |
+
.tab-container button[role="tab"]{
|
| 78 |
+
font-size: 1.5em !important;
|
| 79 |
+
color: inherit;
|
| 80 |
+
}
|
| 81 |
+
.tab-container button[aria-selected="true"] {
|
| 82 |
+
/* background-color: #ebebeb !important; */
|
| 83 |
+
/* color: #ff0000; */
|
| 84 |
+
color: var(--accent-color) !important;
|
| 85 |
+
/* border-color: #ff0000 !important; */
|
| 86 |
+
}
|
| 87 |
+
.tab-container button[aria-selected="true"]::after{
|
| 88 |
+
background-color: var(--accent-color) !important;
|
| 89 |
+
}
|
| 90 |
+
.tabs-container .gr-tab-label[selected] {
|
| 91 |
+
/* background-color: #3378e8 !important; */
|
| 92 |
+
/* color: #fff !important; */
|
| 93 |
+
/* border-color: #3378e8 !important; */
|
| 94 |
+
/* border-color: #ff0000 !important; */
|
| 95 |
+
}
|
| 96 |
+
|
| 97 |
+
.row{
|
| 98 |
+
top: -1px;
|
| 99 |
+
}
|
| 100 |
+
|
| 101 |
+
|
| 102 |
+
/* Tabs content */
|
| 103 |
+
.tab-content{
|
| 104 |
+
font-family: "Roboto Mono", monospace !important;
|
| 105 |
+
}
|
| 106 |
+
.sample-title {
|
| 107 |
+
font-size: 1.1em !important;
|
| 108 |
+
background-color: var(--bg-secondary) !important;
|
| 109 |
+
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
+
/* Audio section container (card) */
|
| 113 |
+
.audio-section {
|
| 114 |
+
padding-bottom: 0px !important;
|
| 115 |
+
margin-bottom: 16px !important;
|
| 116 |
+
border-radius: 8px !important;
|
| 117 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
|
| 118 |
+
text-align: center;
|
| 119 |
+
}
|
| 120 |
+
.audio-row {
|
| 121 |
+
display: flex !important;
|
| 122 |
+
flex-direction: row !important;
|
| 123 |
+
gap: 5px !important;
|
| 124 |
+
margin-top: 0px !important;
|
| 125 |
+
align-items: center !important;
|
| 126 |
+
padding: 5px !important;
|
| 127 |
+
padding-top: 0px !important;
|
| 128 |
+
border-width: 5px !important;
|
| 129 |
+
/* height: 200px; */
|
| 130 |
+
background-color: var(--bg-secondary) !important;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
|
| 136 |
+
/* Audio player styling: set dimensions and remove borders */
|
| 137 |
+
.audio-player {
|
| 138 |
+
/* border-width: 0px !important; */
|
| 139 |
+
border-radius: 5px !important;
|
| 140 |
+
border-width: 0px !important;
|
| 141 |
+
border-style: solid;
|
| 142 |
+
margin: auto;
|
| 143 |
+
background-color: var(--bg-tertiary) !important;
|
| 144 |
+
}
|
| 145 |
+
.audio-player label span{
|
| 146 |
+
/* width: 220px !important;
|
| 147 |
+
height: 200px !important;
|
| 148 |
+
/* border: none !important; */
|
| 149 |
+
/* background: transparent !important; */
|
| 150 |
+
display: none !important;
|
| 151 |
+
|
| 152 |
+
}
|
| 153 |
+
.audio-player label{
|
| 154 |
+
font-weight: normal !important;
|
| 155 |
+
border-radius: 5px;
|
| 156 |
+
color: inherit;
|
| 157 |
+
background-color: var(--accent-color);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
/* Remove default Gradio audio component borders if any */
|
| 162 |
+
.gradio-container .gradio-audio {
|
| 163 |
+
/* border: none !important;
|
| 164 |
+
background: transparent !important; */
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
/* Hide the playback speed button */
|
| 168 |
+
.audio-player button[aria-label="Adjust playback speed to 1.5x"] {
|
| 169 |
+
display: none !important;
|
| 170 |
+
}
|
| 171 |
+
|
| 172 |
+
/* Hide the skip backward and skip forward buttons */
|
| 173 |
+
.gradio-audio, .rewind, .skip{
|
| 174 |
+
display: none !important;
|
| 175 |
+
}
|