Tachyeon commited on
Commit
cdb335c
·
verified ·
1 Parent(s): 281909f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -98
app.py CHANGED
@@ -76,7 +76,7 @@ def separate_audio(path):
76
  files.append(f)
77
  return files
78
 
79
- # ================= UI CSS + layout (polished) =================
80
  css = """
81
  @import url('https://fonts.googleapis.com/css2?family=Anton&family=Poppins:wght@400;500;600&display=swap');
82
 
@@ -91,7 +91,6 @@ css = """
91
  --radius: 12px;
92
  }
93
 
94
- /* page reset */
95
  html, body, .gradio-container {
96
  height: 100%;
97
  margin: 0;
@@ -99,7 +98,6 @@ html, body, .gradio-container {
99
  background: linear-gradient(180deg, var(--bg1), var(--bg2)) !important;
100
  color: var(--ink);
101
  font-family: Poppins, sans-serif;
102
- overflow: auto;
103
  }
104
 
105
  /* wrapper */
@@ -107,61 +105,39 @@ html, body, .gradio-container {
107
  max-width: 1160px;
108
  margin: 0 auto;
109
  padding: 48px 40px;
110
- box-sizing: border-box;
111
  display: grid;
112
  grid-template-rows: auto 1fr;
113
  gap: 36px;
114
  }
115
 
116
- /* logo + tagline (left-anchored brand lockup) */
117
- .brand {
118
- display:flex;
119
- flex-direction:column;
120
- gap:6px;
121
- }
122
- .logo {
123
- font-family: Anton, sans-serif;
124
- font-size:46px;
125
- letter-spacing:1px;
126
- }
127
- .tagline {
128
- font-size:14px;
129
- color:var(--accent);
130
- opacity:0.9;
131
- text-transform: none; /* keep exact caps as user wanted */
132
- }
133
 
134
- /* main grid: left upload (dominant) and right stems column */
135
  .main {
136
  display:grid;
137
- grid-template-columns: 1fr 420px; /* fixed right column to keep alignment predictable */
138
  gap: 48px;
139
- align-items: start; /* ensure top baseline alignment */
140
  }
141
 
142
- /* left column content */
143
  .left h3 { margin: 0; font-size:18px; font-weight:600; }
144
  .left p { margin:6px 0 18px; color:var(--muted); font-size:13px; }
145
 
146
- /* style the Gradio audio drop area so it's visually lighter and slightly shorter */
147
  .left .gradio-audio {
148
  background: var(--panel) !important;
149
- border-radius: var(--radius) !important;
150
- border: 1px solid rgba(255,255,255,0.04) !important;
151
- padding: 12px !important;
152
- box-sizing: border-box;
153
- min-height: 260px; /* reduced height so stems line up better */
154
  display:flex;
155
  align-items:center;
156
  justify-content:center;
157
  }
158
 
159
- /* tone-down the upload inner texts to make them less dominant */
160
- .left .gradio-audio .dropzone, .left .gradio-audio .component, .left .gradio-audio .file {
161
- color: var(--muted) !important;
162
- }
163
-
164
- /* Make the CTA authoritative but balanced */
165
  .button-primary {
166
  margin-top: 18px;
167
  height:46px;
@@ -171,95 +147,60 @@ html, body, .gradio-container {
171
  background: linear-gradient(90deg,#ff6f9f,#ffbf7a) !important;
172
  color: #14080d !important;
173
  border-radius: 10px !important;
174
- border: none !important;
175
- box-shadow: 0 8px 30px rgba(0,0,0,0.25);
176
  }
177
 
178
- /* RIGHT COLUMN (stems) - keep fixed width, grid with 2 columns */
179
  .stems {
180
- display: grid;
181
  grid-template-columns: 1fr 1fr;
182
  gap: 22px;
183
- align-items: start;
184
  }
185
 
186
- /* each stem slot now reads like a subdued surface */
187
  .stem-surface {
188
  background: var(--panel-2);
189
  border-radius: 14px;
190
  padding: 12px;
191
- border: 1px solid rgba(255,255,255,0.03);
192
- box-sizing: border-box;
193
- min-height: 140px; /* consistent stem surface height */
194
- display: flex;
195
- flex-direction: column;
196
- gap: 10px;
197
- justify-content: center;
198
  }
199
 
200
- /* stem label: same system rhythm as body (no competing font) */
201
  .stem-label {
202
  font-size:13px;
203
- font-weight:500;
204
  color: var(--accent);
205
- margin-left: 4px;
206
- }
207
-
208
- /* neutralize Gradio's internal "Audio" label visually so it doesn't fight the stem label */
209
- .stem-surface .gradio-audio label {
210
- display:none !important;
211
- }
212
-
213
- /* smaller inner audio player to avoid odd spacing */
214
- .stem-surface .gradio-audio {
215
- background: transparent !important;
216
- border: 0 !important;
217
- padding: 0 !important;
218
- min-height: 88px !important;
219
- display:flex;
220
- align-items:center;
221
- justify-content:center;
222
  }
223
 
224
- /* ensure the internal audio element doesn't expand */
225
- .stem-surface audio {
226
- width: 92%;
227
- max-height: 36px;
228
- opacity: 0.95;
229
  }
230
 
231
- /* remove any extra left margin coming from gradio wrapper */
232
- .gradio-container .wrap { margin: 0; padding: 0; }
233
-
234
- /* footer info (small) */
235
- .footer {
236
- margin-top: 28px;
237
- text-align: center;
238
- color: var(--muted);
239
- font-size: 12px;
240
- opacity: 0.95;
241
- }
242
 
243
- /* small responsive fallback */
244
  @media (max-width: 980px) {
245
  .main { grid-template-columns: 1fr; }
246
- .stems { grid-template-columns: 1fr 1fr; gap:16px; }
247
- .app { padding: 28px 20px; }
248
  }
249
  """
250
 
251
  with gr.Blocks() as demo:
252
  with gr.Column(elem_classes="app"):
253
 
254
- # Brand lockup (left-anchored)
255
  with gr.Row(elem_classes="brand"):
256
  gr.HTML('<div class="logo">SWARA STUDIO</div>')
257
- # exact user-caps as requested
258
  gr.HTML('<div class="tagline">Separating Music Into Its elements</div>')
259
 
260
- # Main content (left upload, right stems). Top baselines match now.
261
  with gr.Row(elem_classes="main"):
262
- # LEFT: upload + CTA
263
  with gr.Column(elem_classes="left"):
264
  gr.HTML("""
265
  <h3>Select a track</h3>
@@ -268,23 +209,38 @@ with gr.Blocks() as demo:
268
  input_audio = gr.Audio(type="filepath")
269
  run_btn = gr.Button("Separate", elem_classes="button-primary")
270
 
271
- # RIGHT: stems grid (fixed width column)
272
  with gr.Column():
273
  with gr.Row(elem_classes="stems"):
 
274
  with gr.Column(elem_classes="stem-surface"):
275
- gr.HTML('<div class="stem-label">Vocals</div>')
 
 
 
276
  out_vocals = gr.Audio(interactive=False)
 
277
  with gr.Column(elem_classes="stem-surface"):
278
- gr.HTML('<div class="stem-label">Drums</div>')
 
 
 
279
  out_drums = gr.Audio(interactive=False)
 
280
  with gr.Column(elem_classes="stem-surface"):
281
- gr.HTML('<div class="stem-label">Bass</div>')
 
 
 
282
  out_bass = gr.Audio(interactive=False)
 
283
  with gr.Column(elem_classes="stem-surface"):
284
- gr.HTML('<div class="stem-label">Other</div>')
 
 
 
285
  out_other = gr.Audio(interactive=False)
286
 
287
- # wiring — unchanged logic
288
  run_btn.click(separate_audio, input_audio, [out_vocals, out_drums, out_bass, out_other])
289
 
290
  if __name__ == "__main__":
 
76
  files.append(f)
77
  return files
78
 
79
+ # ================= UI CSS (minimal enhancement) =================
80
  css = """
81
  @import url('https://fonts.googleapis.com/css2?family=Anton&family=Poppins:wght@400;500;600&display=swap');
82
 
 
91
  --radius: 12px;
92
  }
93
 
 
94
  html, body, .gradio-container {
95
  height: 100%;
96
  margin: 0;
 
98
  background: linear-gradient(180deg, var(--bg1), var(--bg2)) !important;
99
  color: var(--ink);
100
  font-family: Poppins, sans-serif;
 
101
  }
102
 
103
  /* wrapper */
 
105
  max-width: 1160px;
106
  margin: 0 auto;
107
  padding: 48px 40px;
 
108
  display: grid;
109
  grid-template-rows: auto 1fr;
110
  gap: 36px;
111
  }
112
 
113
+ /* brand */
114
+ .brand { display:flex; flex-direction:column; gap:6px; }
115
+ .logo { font-family: Anton, sans-serif; font-size:46px; letter-spacing:1px; }
116
+ .tagline { font-size:14px; color:var(--accent); opacity:0.9; }
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
+ /* layout */
119
  .main {
120
  display:grid;
121
+ grid-template-columns: 1fr 420px;
122
  gap: 48px;
123
+ align-items: start;
124
  }
125
 
 
126
  .left h3 { margin: 0; font-size:18px; font-weight:600; }
127
  .left p { margin:6px 0 18px; color:var(--muted); font-size:13px; }
128
 
129
+ /* upload */
130
  .left .gradio-audio {
131
  background: var(--panel) !important;
132
+ border-radius: var(--radius);
133
+ border: 1px solid rgba(255,255,255,0.04);
134
+ min-height: 260px;
 
 
135
  display:flex;
136
  align-items:center;
137
  justify-content:center;
138
  }
139
 
140
+ /* button */
 
 
 
 
 
141
  .button-primary {
142
  margin-top: 18px;
143
  height:46px;
 
147
  background: linear-gradient(90deg,#ff6f9f,#ffbf7a) !important;
148
  color: #14080d !important;
149
  border-radius: 10px !important;
 
 
150
  }
151
 
152
+ /* stems */
153
  .stems {
154
+ display:grid;
155
  grid-template-columns: 1fr 1fr;
156
  gap: 22px;
 
157
  }
158
 
 
159
  .stem-surface {
160
  background: var(--panel-2);
161
  border-radius: 14px;
162
  padding: 12px;
163
+ min-height: 140px;
164
+ display:flex;
165
+ flex-direction:column;
166
+ justify-content:center;
167
+ gap:6px;
 
 
168
  }
169
 
 
170
  .stem-label {
171
  font-size:13px;
172
+ font-weight:600;
173
  color: var(--accent);
174
+ letter-spacing: 0.3px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  }
176
 
177
+ .stem-info {
178
+ font-size:11px;
179
+ color:var(--muted);
180
+ line-height:1.35;
181
+ opacity:0.85;
182
  }
183
 
184
+ .stem-surface .gradio-audio label { display:none !important; }
185
+ .stem-surface audio { width:92%; max-height:36px; }
 
 
 
 
 
 
 
 
 
186
 
 
187
  @media (max-width: 980px) {
188
  .main { grid-template-columns: 1fr; }
189
+ .stems { grid-template-columns: 1fr 1fr; }
 
190
  }
191
  """
192
 
193
  with gr.Blocks() as demo:
194
  with gr.Column(elem_classes="app"):
195
 
196
+ # Brand
197
  with gr.Row(elem_classes="brand"):
198
  gr.HTML('<div class="logo">SWARA STUDIO</div>')
 
199
  gr.HTML('<div class="tagline">Separating Music Into Its elements</div>')
200
 
201
+ # Main
202
  with gr.Row(elem_classes="main"):
203
+ # LEFT
204
  with gr.Column(elem_classes="left"):
205
  gr.HTML("""
206
  <h3>Select a track</h3>
 
209
  input_audio = gr.Audio(type="filepath")
210
  run_btn = gr.Button("Separate", elem_classes="button-primary")
211
 
212
+ # RIGHT
213
  with gr.Column():
214
  with gr.Row(elem_classes="stems"):
215
+
216
  with gr.Column(elem_classes="stem-surface"):
217
+ gr.HTML("""
218
+ <div class="stem-label">Lead Vocals</div>
219
+ <div class="stem-info">Primary melodic voice and lyrical content</div>
220
+ """)
221
  out_vocals = gr.Audio(interactive=False)
222
+
223
  with gr.Column(elem_classes="stem-surface"):
224
+ gr.HTML("""
225
+ <div class="stem-label">Mridangam / Percussion</div>
226
+ <div class="stem-info">Rhythmic transients and percussive articulation</div>
227
+ """)
228
  out_drums = gr.Audio(interactive=False)
229
+
230
  with gr.Column(elem_classes="stem-surface"):
231
+ gr.HTML("""
232
+ <div class="stem-label">Tanpura / Drone</div>
233
+ <div class="stem-info">Sustained harmonic bed and tonal reference</div>
234
+ """)
235
  out_bass = gr.Audio(interactive=False)
236
+
237
  with gr.Column(elem_classes="stem-surface"):
238
+ gr.HTML("""
239
+ <div class="stem-label">Violin / Accompaniment</div>
240
+ <div class="stem-info">Melodic support and expressive ornamentation</div>
241
+ """)
242
  out_other = gr.Audio(interactive=False)
243
 
 
244
  run_btn.click(separate_audio, input_audio, [out_vocals, out_drums, out_bass, out_other])
245
 
246
  if __name__ == "__main__":