Update app.py
Browse files
app.py
CHANGED
@@ -31,8 +31,8 @@ def load_model(version):
|
|
31 |
return MusicGen.get_pretrained(version)
|
32 |
|
33 |
|
34 |
-
def predict(
|
35 |
-
text =
|
36 |
global MODEL
|
37 |
topk = int(250)
|
38 |
if MODEL is None or MODEL.name != "melody":
|
@@ -94,7 +94,7 @@ with gr.Blocks() as demo:
|
|
94 |
#split_drums = gr.Audio(type="filepath", label="Drums")
|
95 |
#split_others = gr.Audio(type="filepath", label="Other")
|
96 |
with gr.Row():
|
97 |
-
|
98 |
melody = gr.Audio(source="upload", type="numpy", label="Melody Condition (optional)", interactive=True)
|
99 |
with gr.Row():
|
100 |
submit = gr.Button("Submit")
|
@@ -110,7 +110,7 @@ with gr.Blocks() as demo:
|
|
110 |
with gr.Column():
|
111 |
output = gr.Audio(label="Generated Music")
|
112 |
load_sound_btn.click(split_process, inputs=[uploaded_sound], outputs=[melody])
|
113 |
-
submit.click(predict, inputs=[
|
114 |
|
115 |
gr.Markdown(
|
116 |
"""
|
|
|
31 |
return MusicGen.get_pretrained(version)
|
32 |
|
33 |
|
34 |
+
def predict(music_prompt, melody, duration):
|
35 |
+
text = music_prompt
|
36 |
global MODEL
|
37 |
topk = int(250)
|
38 |
if MODEL is None or MODEL.name != "melody":
|
|
|
94 |
#split_drums = gr.Audio(type="filepath", label="Drums")
|
95 |
#split_others = gr.Audio(type="filepath", label="Other")
|
96 |
with gr.Row():
|
97 |
+
music_prompt = gr.Textbox(label="Musical Prompt", interactive=True)
|
98 |
melody = gr.Audio(source="upload", type="numpy", label="Melody Condition (optional)", interactive=True)
|
99 |
with gr.Row():
|
100 |
submit = gr.Button("Submit")
|
|
|
110 |
with gr.Column():
|
111 |
output = gr.Audio(label="Generated Music")
|
112 |
load_sound_btn.click(split_process, inputs=[uploaded_sound], outputs=[melody])
|
113 |
+
submit.click(predict, inputs=[music_prompt, melody, duration], outputs=[output])
|
114 |
|
115 |
gr.Markdown(
|
116 |
"""
|