Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -222,26 +222,27 @@ def generate_and_return_files(bpm, temperature, top_k, uploaded_sf2=None, output
|
|
| 222 |
|
| 223 |
|
| 224 |
custom_css = """
|
| 225 |
-
#
|
| 226 |
max-width: 1200px !important;
|
| 227 |
margin: 0 auto;
|
|
|
|
| 228 |
}
|
| 229 |
|
| 230 |
#generate-btn {
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
|
| 245 |
"""
|
| 246 |
|
| 247 |
waveform_opts = gr.WaveformOptions(
|
|
@@ -251,26 +252,27 @@ waveform_opts = gr.WaveformOptions(
|
|
| 251 |
)
|
| 252 |
|
| 253 |
with gr.Blocks(css=custom_css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Roboto"), "sans-serif"])) as iface:
|
| 254 |
-
gr.
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
|
|
|
| 273 |
|
| 274 |
-
|
| 275 |
|
| 276 |
iface.launch(share=True)
|
|
|
|
| 222 |
|
| 223 |
|
| 224 |
custom_css = """
|
| 225 |
+
#container {
|
| 226 |
max-width: 1200px !important;
|
| 227 |
margin: 0 auto;
|
| 228 |
+
padding: 0 16px;
|
| 229 |
}
|
| 230 |
|
| 231 |
#generate-btn {
|
| 232 |
+
font-size: 18px;
|
| 233 |
+
color: white;
|
| 234 |
+
padding: 10px 20px;
|
| 235 |
+
border: none;
|
| 236 |
+
border-radius: 5px;
|
| 237 |
+
cursor: pointer;
|
| 238 |
+
background: linear-gradient(90deg, hsla(268, 90%, 68%, 1) 0%, hsla(260, 72%, 70%, 1) 50%, hsla(247, 73%, 65%, 1) 100%);
|
| 239 |
+
transition: background 1s ease;
|
| 240 |
+
}
|
| 241 |
+
|
| 242 |
+
#generate-btn:hover {
|
| 243 |
+
color: white;
|
| 244 |
+
background: linear-gradient(90deg, hsla(268, 90%, 78%, 1) 0%, hsla(260, 72%, 80%, 1) 50%, hsla(247, 73%, 75%, 1) 100%);
|
| 245 |
+
}
|
| 246 |
"""
|
| 247 |
|
| 248 |
waveform_opts = gr.WaveformOptions(
|
|
|
|
| 252 |
)
|
| 253 |
|
| 254 |
with gr.Blocks(css=custom_css, theme=gr.themes.Default(font=[gr.themes.GoogleFont("Roboto"), "sans-serif"])) as iface:
|
| 255 |
+
with gr.Column(elem_id="container"):
|
| 256 |
+
gr.Markdown("<h1 style='font-weight: bold; text-align: center; font-size: 40px; margin: 0px;'>nanoMPC</h1>")
|
| 257 |
+
gr.Markdown("<p style='text-align: center; font-size: 18px;'>nanoMPC is a MIDI transformer model that generates lo-fi and boom bap beats.</p>")
|
| 258 |
+
|
| 259 |
+
bpm = gr.Slider(minimum=50, maximum=200, step=1, value=100, label="BPM")
|
| 260 |
+
temperature = gr.Slider(minimum=0.1, maximum=2.0, step=0.1, value=1.0, label="Temperature")
|
| 261 |
+
top_k = gr.Slider(minimum=4, maximum=16, step=1, value=8, label="Top-k")
|
| 262 |
+
output_level = gr.Slider(minimum=0, maximum=3, step=0.10, value=2.0, label="Output Gain")
|
| 263 |
+
midi_file = gr.File(label="MIDI Output")
|
| 264 |
+
audio_file = gr.Audio(label="Audio Output", type="filepath", waveform_options=waveform_opts)
|
| 265 |
+
generate_button = gr.Button("Generate", elem_id="generate-btn")
|
| 266 |
+
soundfont = gr.File(label="Optional: Upload SoundFont (preset=0, bank=0)")
|
| 267 |
+
|
| 268 |
+
generate_button.click(
|
| 269 |
+
fn=generate_and_return_files,
|
| 270 |
+
inputs=[bpm, temperature, top_k, soundfont, output_level],
|
| 271 |
+
outputs=[midi_file, audio_file]
|
| 272 |
+
)
|
| 273 |
+
|
| 274 |
+
gr.Markdown("<p style='text-align: center; font-size: 14px;'>Developed by <a href='https://www.patchbanks.com/' target='_blank'><strong>Patchbanks</strong></a></p>")
|
| 275 |
|
| 276 |
+
iface.launch(share=True)
|
| 277 |
|
| 278 |
iface.launch(share=True)
|