Spaces:
Running
Running
Fabrice-TIERCELIN
commited on
Commit
•
f66088a
1
Parent(s):
8e0cf3d
Better hide information
Browse files- demos/musicgen_app.py +20 -5
demos/musicgen_app.py
CHANGED
@@ -221,9 +221,11 @@ def predict_full(model, model_path, decoder, text, melody, duration, topk, topp,
|
|
221 |
[text], [melody], duration, progress=True,
|
222 |
top_k=topk, top_p=topp, temperature=temperature, cfg_coef=cfg_coef,
|
223 |
gradio_progress=progress)
|
|
|
|
|
224 |
if USE_DIFFUSION:
|
225 |
-
return videos[0], wavs[0],
|
226 |
-
return videos[0], wavs[0],
|
227 |
|
228 |
|
229 |
def toggle_audio_src(choice):
|
@@ -240,6 +242,14 @@ def toggle_diffusion(choice):
|
|
240 |
return [gr.update(visible = False)] * 2
|
241 |
|
242 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
def ui_full(launch_kwargs):
|
244 |
with gr.Blocks() as interface:
|
245 |
gr.Markdown(
|
@@ -297,13 +307,15 @@ def ui_full(launch_kwargs):
|
|
297 |
_ = gr.Button("Abort all", variant="stop").click(fn=interrupt, queue = False)
|
298 |
with gr.Column():
|
299 |
output = gr.Video(label="Generated Music")
|
300 |
-
audio_output = gr.Audio(label="Generated Music (wav)", type='filepath', autoplay = True, show_download_button = True)
|
301 |
-
output_hint = gr.Label()
|
302 |
diffusion_output = gr.Video(label="MultiBand Diffusion Decoder")
|
303 |
audio_diffusion = gr.Audio(label="MultiBand Diffusion Decoder (wav)", type='filepath')
|
304 |
submit.click(toggle_diffusion, decoder, [
|
305 |
diffusion_output,
|
306 |
audio_diffusion
|
|
|
|
|
307 |
], queue=False, show_progress=False).then(predict_full, inputs = [
|
308 |
model,
|
309 |
model_path,
|
@@ -322,7 +334,10 @@ def ui_full(launch_kwargs):
|
|
322 |
output_hint,
|
323 |
diffusion_output,
|
324 |
audio_diffusion
|
325 |
-
], scroll_to_output = True)
|
|
|
|
|
|
|
326 |
radio.change(toggle_audio_src, radio, [melody], queue = False, show_progress = False)
|
327 |
|
328 |
gr.Examples(
|
|
|
221 |
[text], [melody], duration, progress=True,
|
222 |
top_k=topk, top_p=topp, temperature=temperature, cfg_coef=cfg_coef,
|
223 |
gradio_progress=progress)
|
224 |
+
information = "To download the output, right-click and click on Save as..."
|
225 |
+
|
226 |
if USE_DIFFUSION:
|
227 |
+
return videos[0], wavs[0], information, videos[1], wavs[1]
|
228 |
+
return videos[0], wavs[0], information, None, None
|
229 |
|
230 |
|
231 |
def toggle_audio_src(choice):
|
|
|
242 |
return [gr.update(visible = False)] * 2
|
243 |
|
244 |
|
245 |
+
def show_information(choice):
|
246 |
+
return [gr.update(visible = True)]
|
247 |
+
|
248 |
+
|
249 |
+
def hide_information(choice):
|
250 |
+
return [gr.update(visible = False)]
|
251 |
+
|
252 |
+
|
253 |
def ui_full(launch_kwargs):
|
254 |
with gr.Blocks() as interface:
|
255 |
gr.Markdown(
|
|
|
307 |
_ = gr.Button("Abort all", variant="stop").click(fn=interrupt, queue = False)
|
308 |
with gr.Column():
|
309 |
output = gr.Video(label="Generated Music")
|
310 |
+
audio_output = gr.Audio(label = "Generated Music (wav)", type='filepath', autoplay = True, show_download_button = True)
|
311 |
+
output_hint = gr.Label(label = "Information")
|
312 |
diffusion_output = gr.Video(label="MultiBand Diffusion Decoder")
|
313 |
audio_diffusion = gr.Audio(label="MultiBand Diffusion Decoder (wav)", type='filepath')
|
314 |
submit.click(toggle_diffusion, decoder, [
|
315 |
diffusion_output,
|
316 |
audio_diffusion
|
317 |
+
], queue=False, show_progress=False).then(hide_information, decoder, [
|
318 |
+
output_hint
|
319 |
], queue=False, show_progress=False).then(predict_full, inputs = [
|
320 |
model,
|
321 |
model_path,
|
|
|
334 |
output_hint,
|
335 |
diffusion_output,
|
336 |
audio_diffusion
|
337 |
+
], scroll_to_output = True).then(show_information, decoder, [
|
338 |
+
output_hint
|
339 |
+
], queue=False, show_progress=False)
|
340 |
+
|
341 |
radio.change(toggle_audio_src, radio, [melody], queue = False, show_progress = False)
|
342 |
|
343 |
gr.Examples(
|