Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -123,7 +123,7 @@ def split_lyrics(lyrics: str):
|
|
| 123 |
def generate_music(
|
| 124 |
genre_txt=None,
|
| 125 |
lyrics_txt=None,
|
| 126 |
-
run_n_segments=
|
| 127 |
max_new_tokens=45,
|
| 128 |
use_audio_prompt=False,
|
| 129 |
audio_prompt_path="",
|
|
@@ -333,18 +333,17 @@ with gr.Blocks() as demo:
|
|
| 333 |
with gr.Column():
|
| 334 |
genre_txt = gr.Textbox(label="Genre")
|
| 335 |
lyrics_txt = gr.Textbox(label="Lyrics")
|
| 336 |
-
use_audio_prompt = gr.Checkbox(label="Use Audio Prompt?", value=False)
|
| 337 |
audio_prompt_input = gr.Audio(type="filepath", label="Audio Prompt (Optional)")
|
| 338 |
with gr.Column():
|
| 339 |
num_segments = gr.Number(label="Number of Segments", value=2, interactive=True)
|
| 340 |
-
max_new_tokens = gr.Slider(label="Duration of song", minimum=1, maximum=
|
| 341 |
submit_btn = gr.Button("Submit")
|
| 342 |
music_out = gr.Audio(label="Mixed Audio Result")
|
| 343 |
with gr.Accordion(label="Vocal and Instrumental Result", open=False):
|
| 344 |
vocal_out = gr.Audio(label="Vocal Audio")
|
| 345 |
instrumental_out = gr.Audio(label="Instrumental Audio")
|
| 346 |
-
|
| 347 |
-
|
| 348 |
# When the "Submit" button is clicked, pass the additional audio-related inputs to the function.
|
| 349 |
submit_btn.click(
|
| 350 |
fn=generate_music,
|
|
@@ -386,8 +385,18 @@ But they don't feel this love the way we do
|
|
| 386 |
My heart beats only for you, can't you see?
|
| 387 |
I won't let you slip away from me
|
| 388 |
"""
|
| 389 |
-
]
|
| 390 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 391 |
"""[verse]
|
| 392 |
Woke up in the morning, sun is shining bright
|
| 393 |
Chasing all my dreams, gotta get my mind right
|
|
@@ -433,8 +442,11 @@ Locked inside my mind, hot flame.
|
|
| 433 |
inputs=[genre_txt, lyrics_txt],
|
| 434 |
outputs=[music_out, vocal_out, instrumental_out],
|
| 435 |
cache_examples=True,
|
| 436 |
-
cache_mode="
|
| 437 |
fn=generate_music
|
| 438 |
)
|
| 439 |
|
|
|
|
|
|
|
|
|
|
| 440 |
demo.queue().launch(show_error=True)
|
|
|
|
| 123 |
def generate_music(
|
| 124 |
genre_txt=None,
|
| 125 |
lyrics_txt=None,
|
| 126 |
+
run_n_segments=2,
|
| 127 |
max_new_tokens=45,
|
| 128 |
use_audio_prompt=False,
|
| 129 |
audio_prompt_path="",
|
|
|
|
| 333 |
with gr.Column():
|
| 334 |
genre_txt = gr.Textbox(label="Genre")
|
| 335 |
lyrics_txt = gr.Textbox(label="Lyrics")
|
| 336 |
+
use_audio_prompt = gr.Checkbox(label="Use Audio Prompt ?", value=False)
|
| 337 |
audio_prompt_input = gr.Audio(type="filepath", label="Audio Prompt (Optional)")
|
| 338 |
with gr.Column():
|
| 339 |
num_segments = gr.Number(label="Number of Segments", value=2, interactive=True)
|
| 340 |
+
max_new_tokens = gr.Slider(label="Duration of song", minimum=1, maximum=45, step=1, value=30, interactive=True)
|
| 341 |
submit_btn = gr.Button("Submit")
|
| 342 |
music_out = gr.Audio(label="Mixed Audio Result")
|
| 343 |
with gr.Accordion(label="Vocal and Instrumental Result", open=False):
|
| 344 |
vocal_out = gr.Audio(label="Vocal Audio")
|
| 345 |
instrumental_out = gr.Audio(label="Instrumental Audio")
|
| 346 |
+
|
|
|
|
| 347 |
# When the "Submit" button is clicked, pass the additional audio-related inputs to the function.
|
| 348 |
submit_btn.click(
|
| 349 |
fn=generate_music,
|
|
|
|
| 385 |
My heart beats only for you, can't you see?
|
| 386 |
I won't let you slip away from me
|
| 387 |
"""
|
| 388 |
+
]
|
| 389 |
+
],
|
| 390 |
+
inputs=[genre_txt, lyrics_txt],
|
| 391 |
+
outputs=[music_out, vocal_out, instrumental_out],
|
| 392 |
+
cache_examples=True,
|
| 393 |
+
cache_mode="eager",
|
| 394 |
+
fn=generate_music
|
| 395 |
+
)
|
| 396 |
+
|
| 397 |
+
gr.Examples(
|
| 398 |
+
examples=[
|
| 399 |
+
["rap piano street tough piercing vocal hip-hop synthesizer clear vocal male",
|
| 400 |
"""[verse]
|
| 401 |
Woke up in the morning, sun is shining bright
|
| 402 |
Chasing all my dreams, gotta get my mind right
|
|
|
|
| 442 |
inputs=[genre_txt, lyrics_txt],
|
| 443 |
outputs=[music_out, vocal_out, instrumental_out],
|
| 444 |
cache_examples=True,
|
| 445 |
+
cache_mode="lazy",
|
| 446 |
fn=generate_music
|
| 447 |
)
|
| 448 |
|
| 449 |
+
gr.Markdown("## Call for Contributions\nIf you find this space interesting please π this space and feel free to contribute.\n### TODO:\n1. [Aeromamba](https://huggingface.co/innova-ai/AEROMamba) for output enhancement.")
|
| 450 |
+
|
| 451 |
+
|
| 452 |
demo.queue().launch(show_error=True)
|