comidan commited on
Commit
9c6e49c
·
verified ·
1 Parent(s): 9cae843

Update demos/musicgen_app.py

Browse files
Files changed (1) hide show
  1. demos/musicgen_app.py +11 -96
demos/musicgen_app.py CHANGED
@@ -244,10 +244,8 @@ def ui_full(launch_kwargs):
244
  with gr.Blocks() as interface:
245
  gr.Markdown(
246
  """
247
- # MusicGen
248
- This is your private demo for [MusicGen](https://github.com/facebookresearch/audiocraft),
249
- a simple and controllable model for music generation
250
- presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284)
251
  """
252
  )
253
  with gr.Row():
@@ -264,12 +262,12 @@ def ui_full(launch_kwargs):
264
  # Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
265
  _ = gr.Button("Interrupt").click(fn=interrupt, queue=False)
266
  with gr.Row():
267
- model = gr.Radio(["facebook/musicgen-melody", "facebook/musicgen-medium", "facebook/musicgen-small",
268
- "facebook/musicgen-large", "facebook/musicgen-melody-large",
269
- "facebook/musicgen-stereo-small", "facebook/musicgen-stereo-medium",
270
- "facebook/musicgen-stereo-melody", "facebook/musicgen-stereo-large",
271
- "facebook/musicgen-stereo-melody-large"],
272
- label="Model", value="facebook/musicgen-stereo-melody", interactive=True)
273
  model_path = gr.Text(label="Model Path (custom models)")
274
  with gr.Row():
275
  decoder = gr.Radio(["Default", "MultiBand_Diffusion"],
@@ -292,49 +290,6 @@ def ui_full(launch_kwargs):
292
  outputs=[output, audio_output, diffusion_output, audio_diffusion])
293
  radio.change(toggle_audio_src, radio, [melody], queue=False, show_progress=False)
294
 
295
- gr.Examples(
296
- fn=predict_full,
297
- examples=[
298
- [
299
- "An 80s driving pop song with heavy drums and synth pads in the background",
300
- "./assets/bach.mp3",
301
- "facebook/musicgen-stereo-melody",
302
- "Default"
303
- ],
304
- [
305
- "A cheerful country song with acoustic guitars",
306
- "./assets/bolero_ravel.mp3",
307
- "facebook/musicgen-stereo-melody",
308
- "Default"
309
- ],
310
- [
311
- "90s rock song with electric guitar and heavy drums",
312
- None,
313
- "facebook/musicgen-stereo-medium",
314
- "Default"
315
- ],
316
- [
317
- "a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions",
318
- "./assets/bach.mp3",
319
- "facebook/musicgen-stereo-melody",
320
- "Default"
321
- ],
322
- [
323
- "lofi slow bpm electro chill with organic samples",
324
- None,
325
- "facebook/musicgen-stereo-medium",
326
- "Default"
327
- ],
328
- [
329
- "Punk rock with loud drum and power guitar",
330
- None,
331
- "facebook/musicgen-stereo-medium",
332
- "MultiBand_Diffusion"
333
- ],
334
- ],
335
- inputs=[text, melody, model, decoder],
336
- outputs=[output]
337
- )
338
  gr.Markdown(
339
  """
340
  ### More details
@@ -375,8 +330,7 @@ def ui_full(launch_kwargs):
375
  at an extra computational cost. When this is selected, we provide both the GAN based decoded
376
  audio, and the one obtained with MBD.
377
 
378
- See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft/blob/main/docs/MUSICGEN.md)
379
- for more details.
380
  """
381
  )
382
 
@@ -387,17 +341,8 @@ def ui_batched(launch_kwargs):
387
  with gr.Blocks() as demo:
388
  gr.Markdown(
389
  """
390
- # MusicGen
391
-
392
- This is the demo for [MusicGen](https://github.com/facebookresearch/audiocraft/blob/main/docs/MUSICGEN.md),
393
- a simple and controllable model for music generation
394
- presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284).
395
- <br/>
396
- <a href="https://huggingface.co/spaces/facebook/MusicGen?duplicate=true"
397
- style="display: inline-block;margin-top: .5em;margin-right: .25em;" target="_blank">
398
- <img style="margin-bottom: 0em;display: inline;margin-top: -.25em;"
399
- src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
400
- for longer sequences, more control and no queue.</p>
401
  """
402
  )
403
  with gr.Row():
@@ -417,33 +362,6 @@ def ui_batched(launch_kwargs):
417
  submit.click(predict_batched, inputs=[text, melody],
418
  outputs=[output, audio_output], batch=True, max_batch_size=MAX_BATCH_SIZE)
419
  radio.change(toggle_audio_src, radio, [melody], queue=False, show_progress=False)
420
- gr.Examples(
421
- fn=predict_batched,
422
- examples=[
423
- [
424
- "An 80s driving pop song with heavy drums and synth pads in the background",
425
- "./assets/bach.mp3",
426
- ],
427
- [
428
- "A cheerful country song with acoustic guitars",
429
- "./assets/bolero_ravel.mp3",
430
- ],
431
- [
432
- "90s rock song with electric guitar and heavy drums",
433
- None,
434
- ],
435
- [
436
- "a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions bpm: 130",
437
- "./assets/bach.mp3",
438
- ],
439
- [
440
- "lofi slow bpm electro chill with organic samples",
441
- None,
442
- ],
443
- ],
444
- inputs=[text, melody],
445
- outputs=[output]
446
- )
447
  gr.Markdown("""
448
  ### More details
449
 
@@ -465,9 +383,6 @@ def ui_batched(launch_kwargs):
465
  If you have a GPU, you can run the gradio demo locally (click the link to our repo below for more info).
466
  Finally, you can get a GPU for free from Google
467
  and run the demo in [a Google Colab.](https://ai.honu.io/red/musicgen-colab).
468
-
469
- See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft/blob/main/docs/MUSICGEN.md)
470
- for more details. All samples are generated with the `stereo-melody` model.
471
  """)
472
 
473
  demo.queue(max_size=8 * 4).launch(**launch_kwargs)
 
244
  with gr.Blocks() as interface:
245
  gr.Markdown(
246
  """
247
+ # MusicGen IBM
248
+ IBM demo deployment
 
 
249
  """
250
  )
251
  with gr.Row():
 
262
  # Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
263
  _ = gr.Button("Interrupt").click(fn=interrupt, queue=False)
264
  with gr.Row():
265
+ model = "facebook/" + gr.Radio(["musicgen-melody", "musicgen-medium", "musicgen-small",
266
+ "musicgen-large", "musicgen-melody-large",
267
+ "musicgen-stereo-small", "musicgen-stereo-medium",
268
+ "musicgen-stereo-melody", "musicgen-stereo-large",
269
+ "musicgen-stereo-melody-large"],
270
+ label="Model", value="musicgen-stereo-melody", interactive=True)
271
  model_path = gr.Text(label="Model Path (custom models)")
272
  with gr.Row():
273
  decoder = gr.Radio(["Default", "MultiBand_Diffusion"],
 
290
  outputs=[output, audio_output, diffusion_output, audio_diffusion])
291
  radio.change(toggle_audio_src, radio, [melody], queue=False, show_progress=False)
292
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
293
  gr.Markdown(
294
  """
295
  ### More details
 
330
  at an extra computational cost. When this is selected, we provide both the GAN based decoded
331
  audio, and the one obtained with MBD.
332
 
333
+
 
334
  """
335
  )
336
 
 
341
  with gr.Blocks() as demo:
342
  gr.Markdown(
343
  """
344
+ # MusicGen IBM
345
+ IBM demo deployment
 
 
 
 
 
 
 
 
 
346
  """
347
  )
348
  with gr.Row():
 
362
  submit.click(predict_batched, inputs=[text, melody],
363
  outputs=[output, audio_output], batch=True, max_batch_size=MAX_BATCH_SIZE)
364
  radio.change(toggle_audio_src, radio, [melody], queue=False, show_progress=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
365
  gr.Markdown("""
366
  ### More details
367
 
 
383
  If you have a GPU, you can run the gradio demo locally (click the link to our repo below for more info).
384
  Finally, you can get a GPU for free from Google
385
  and run the demo in [a Google Colab.](https://ai.honu.io/red/musicgen-colab).
 
 
 
386
  """)
387
 
388
  demo.queue(max_size=8 * 4).launch(**launch_kwargs)