fffiloni commited on
Commit
4a977ff
·
1 Parent(s): 3620bd1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -25
app.py CHANGED
@@ -77,19 +77,24 @@ def predict(music_prompt, melody, duration):
77
  #waveform_video = gr.make_waveform(file.name)
78
  return file.name
79
 
 
 
 
 
80
 
81
- with gr.Blocks() as demo:
82
- gr.Markdown(
83
- """
84
- # Split Audio to MusicGen
85
- <br/>
86
- <a href="https://huggingface.co/spaces/fffiloni/SplitTrack2MusicGen?duplicate=true" style="display: inline-block;margin-top: .5em;margin-right: .25em;" target="_blank">
87
- <img style="margin-bottom: 0em;display: inline;margin-top: -.25em;" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
88
- for longer sequences, more control and no queue.</p>
89
- """
90
- )
91
- with gr.Row():
92
-
 
93
  with gr.Row():
94
  uploaded_sound = gr.Audio(type="numpy", label="Input", source="upload")
95
  chosen_track = gr.Radio(["vocals", "bass", "drums", "other"], label="Track", info="Which track from your audio do you want to mashup ?", value="vocals")
@@ -101,19 +106,19 @@ with gr.Blocks() as demo:
101
  with gr.Row():
102
  music_prompt = gr.Textbox(label="Musical Prompt", info="Describe what kind music you wish for", interactive=True)
103
  melody = gr.Audio(source="upload", type="numpy", label="Melody Condition (optional)", interactive=False)
104
- #with gr.Row():
105
- # model = gr.Radio(["melody", "medium", "small", "large"], label="Model", value="melody", interactive=True)
106
- with gr.Row():
107
- duration = gr.Slider(minimum=1, maximum=30, value=10, step=1, label="Duration", interactive=True)
108
- with gr.Row():
109
- submit = gr.Button("Submit")
110
- #with gr.Row():
111
- # topk = gr.Number(label="Top-k", value=250, interactive=True)
112
- # topp = gr.Number(label="Top-p", value=0, interactive=True)
113
- # temperature = gr.Number(label="Temperature", value=1.0, interactive=True)
114
- # cfg_coef = gr.Number(label="Classifier Free Guidance", value=3.0, interactive=True)
115
-
116
- output = gr.Audio(label="Generated Music")
117
  load_sound_btn.click(split_process, inputs=[uploaded_sound, chosen_track], outputs=[melody])
118
  submit.click(predict, inputs=[music_prompt, melody, duration], outputs=[output])
119
 
 
77
  #waveform_video = gr.make_waveform(file.name)
78
  return file.name
79
 
80
+ css="""
81
+ #col-container {max-width: 510px; margin-left: auto; margin-right: auto;}
82
+ a {text-decoration-line: underline; font-weight: 600;}
83
+ """
84
 
85
+ with gr.Blocks(css=css) as demo:
86
+ with gr.Column(elem_id="col-container"):
87
+ gr.Markdown(
88
+ """
89
+ # Split Audio to MusicGen
90
+ Upload an audio file, split audio tracks with Demucs, choose a track as conditional sound for MusicGen, get a remix !
91
+ <br/>
92
+ <a href="https://huggingface.co/spaces/fffiloni/SplitTrack2MusicGen?duplicate=true" style="display: inline-block;margin-top: .5em;margin-right: .25em;" target="_blank">
93
+ <img style="margin-bottom: 0em;display: inline;margin-top: -.25em;" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
94
+ for longer sequences, more control and no queue.</p>
95
+ """
96
+ )
97
+
98
  with gr.Row():
99
  uploaded_sound = gr.Audio(type="numpy", label="Input", source="upload")
100
  chosen_track = gr.Radio(["vocals", "bass", "drums", "other"], label="Track", info="Which track from your audio do you want to mashup ?", value="vocals")
 
106
  with gr.Row():
107
  music_prompt = gr.Textbox(label="Musical Prompt", info="Describe what kind music you wish for", interactive=True)
108
  melody = gr.Audio(source="upload", type="numpy", label="Melody Condition (optional)", interactive=False)
109
+ #with gr.Row():
110
+ # model = gr.Radio(["melody", "medium", "small", "large"], label="Model", value="melody", interactive=True)
111
+ with gr.Row():
112
+ duration = gr.Slider(minimum=1, maximum=30, value=10, step=1, label="Duration", interactive=True)
113
+ with gr.Row():
114
+ submit = gr.Button("Submit")
115
+ #with gr.Row():
116
+ # topk = gr.Number(label="Top-k", value=250, interactive=True)
117
+ # topp = gr.Number(label="Top-p", value=0, interactive=True)
118
+ # temperature = gr.Number(label="Temperature", value=1.0, interactive=True)
119
+ # cfg_coef = gr.Number(label="Classifier Free Guidance", value=3.0, interactive=True)
120
+
121
+ output = gr.Audio(label="Generated Music")
122
  load_sound_btn.click(split_process, inputs=[uploaded_sound, chosen_track], outputs=[melody])
123
  submit.click(predict, inputs=[music_prompt, melody, duration], outputs=[output])
124