Fabrice-TIERCELIN commited on
Commit
07ea31c
·
verified ·
1 Parent(s): 2cca5ed

Complete the examples

Browse files
Files changed (1) hide show
  1. demos/musicgen_app.py +9 -7
demos/musicgen_app.py CHANGED
@@ -264,10 +264,6 @@ def ui_full(launch_kwargs):
264
  interactive=True, elem_id="melody-input")
265
  with gr.Row():
266
  duration = gr.Slider(label = "Duration", info = "(in seconds)", minimum = 1, maximum = 120, value = 10, interactive = True)
267
- with gr.Row():
268
- submit = gr.Button("Generate", variant = "primary")
269
- # Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
270
- _ = gr.Button("Abort all", variant="stop").click(fn=interrupt, queue = False)
271
  with gr.Accordion("Advanced options", open = False):
272
  with gr.Row():
273
  topk = gr.Number(label="Top-k", info = "Number of tokens shortlisted", value = 250, interactive = True)
@@ -286,9 +282,13 @@ def ui_full(launch_kwargs):
286
  "facebook/musicgen-stereo-melody-large"],
287
  label="Model", value="facebook/musicgen-stereo-melody", interactive=True)
288
  model_path = gr.Text(label="Model Path (custom models)")
 
 
 
 
289
  with gr.Column():
290
- output = gr.Video(label="Generated Music")
291
- audio_output = gr.Audio(label="Generated Music (wav)", type='filepath')
292
  diffusion_output = gr.Video(label="MultiBand Diffusion Decoder")
293
  audio_diffusion = gr.Audio(label="MultiBand Diffusion Decoder (wav)", type='filepath')
294
  submit.click(toggle_diffusion, decoder, [diffusion_output, audio_diffusion], queue=False,
@@ -303,17 +303,19 @@ def ui_full(launch_kwargs):
303
  [
304
  "An angry propulsive industrial score with distorted synthesizers and tortured vocals.",
305
  None,
 
306
  "facebook/musicgen-stereo-melody",
307
  "Default"
308
  ],
309
  [
310
  "A monstrous industrial bach hybrid",
311
  "./assets/bach.mp3",
 
312
  "facebook/musicgen-stereo-melody",
313
  "Default"
314
  ],
315
  ],
316
- inputs=[text, melody, model, decoder],
317
  outputs=[output]
318
  )
319
  gr.Markdown(
 
264
  interactive=True, elem_id="melody-input")
265
  with gr.Row():
266
  duration = gr.Slider(label = "Duration", info = "(in seconds)", minimum = 1, maximum = 120, value = 10, interactive = True)
 
 
 
 
267
  with gr.Accordion("Advanced options", open = False):
268
  with gr.Row():
269
  topk = gr.Number(label="Top-k", info = "Number of tokens shortlisted", value = 250, interactive = True)
 
282
  "facebook/musicgen-stereo-melody-large"],
283
  label="Model", value="facebook/musicgen-stereo-melody", interactive=True)
284
  model_path = gr.Text(label="Model Path (custom models)")
285
+ with gr.Row():
286
+ submit = gr.Button("Generate", variant = "primary")
287
+ # Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
288
+ _ = gr.Button("Abort all", variant="stop").click(fn=interrupt, queue = False)
289
  with gr.Column():
290
+ output = gr.Video(label="Generated Music", autoplay = True)
291
+ audio_output = gr.Audio(label="Generated Music (wav)", type='filepath', show_download_button = True)
292
  diffusion_output = gr.Video(label="MultiBand Diffusion Decoder")
293
  audio_diffusion = gr.Audio(label="MultiBand Diffusion Decoder (wav)", type='filepath')
294
  submit.click(toggle_diffusion, decoder, [diffusion_output, audio_diffusion], queue=False,
 
303
  [
304
  "An angry propulsive industrial score with distorted synthesizers and tortured vocals.",
305
  None,
306
+ 10,
307
  "facebook/musicgen-stereo-melody",
308
  "Default"
309
  ],
310
  [
311
  "A monstrous industrial bach hybrid",
312
  "./assets/bach.mp3",
313
+ 10,
314
  "facebook/musicgen-stereo-melody",
315
  "Default"
316
  ],
317
  ],
318
+ inputs=[text, melody, duration, model, decoder],
319
  outputs=[output]
320
  )
321
  gr.Markdown(