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

Hide advanced options

Browse files
Files changed (1) hide show
  1. demos/musicgen_app.py +22 -18
demos/musicgen_app.py CHANGED
@@ -248,6 +248,9 @@ def ui_full(launch_kwargs):
248
  Derived from [MusicGen](https://github.com/facebookresearch/audiocraft),
249
  presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284).
250
  MusicGen gets better results than other AIs like WaveFormer.
 
 
 
251
  """
252
  )
253
  with gr.Row():
@@ -259,29 +262,30 @@ def ui_full(launch_kwargs):
259
  label="Condition on a melody (optional) File or Microphone")
260
  melody = gr.Audio(source="upload", type="numpy", label="File",
261
  interactive=True, elem_id="melody-input")
 
 
262
  with gr.Row():
263
  submit = gr.Button("Generate", variant = "primary")
264
  # Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
265
  _ = gr.Button("Abort all", variant="stop").click(fn=interrupt, queue = False)
266
- with gr.Row():
267
- duration = gr.Slider(label = "Duration", info = "(in seconds)", minimum = 1, maximum = 120, value = 10, interactive = True)
268
- with gr.Row():
269
- topk = gr.Number(label="Top-k", info = "Number of tokens shortlisted", value = 250, interactive = True)
270
- topp = gr.Number(label="Top-p", info = "Percent of tokens shortlisted", value = 0, interactive = True)
271
- temperature = gr.Number(label="Temperature", info = "lower=Always similar, higher=More creative", value = 1.0, interactive = True)
272
- cfg_coef = gr.Number(label="Classifier-Free Guidance", info = "lower=Audio quality, higher=Follow the prompt", value = 3.0, interactive=True)
273
- with gr.Row():
274
- decoder = gr.Radio(["Default", "MultiBand_Diffusion"],
275
  label="Decoder", value="Default", interactive=True)
276
- with gr.Row():
277
- model = gr.Radio(["facebook/musicgen-melody", "facebook/musicgen-medium", "facebook/musicgen-small",
278
- "facebook/musicgen-large",
279
- "facebook/musicgen-melody-large",
280
- "facebook/musicgen-stereo-small", "facebook/musicgen-stereo-medium",
281
- "facebook/musicgen-stereo-melody", "facebook/musicgen-stereo-large",
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.Column():
286
  output = gr.Video(label="Generated Music")
287
  audio_output = gr.Audio(label="Generated Music (wav)", type='filepath')
 
248
  Derived from [MusicGen](https://github.com/facebookresearch/audiocraft),
249
  presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284).
250
  MusicGen gets better results than other AIs like WaveFormer.
251
+ You can duplicate this space on a free account, it works on CPU.
252
+ <a href="https://huggingface.co/spaces/Fabrice-TIERCELIN/Text-to-Music?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14"></a>
253
+
254
  """
255
  )
256
  with gr.Row():
 
262
  label="Condition on a melody (optional) File or Microphone")
263
  melody = gr.Audio(source="upload", type="numpy", label="File",
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)
274
+ topp = gr.Number(label="Top-p", info = "Percent of tokens shortlisted", value = 0, interactive = True)
275
+ temperature = gr.Number(label="Temperature", info = "lower=Always similar, higher=More creative", value = 1.0, interactive = True)
276
+ cfg_coef = gr.Number(label="Classifier-Free Guidance", info = "lower=Audio quality, higher=Follow the prompt", value = 3.0, interactive=True)
277
+ with gr.Row():
278
+ decoder = gr.Radio(["Default", "MultiBand_Diffusion"],
 
279
  label="Decoder", value="Default", interactive=True)
280
+ with gr.Row():
281
+ model = gr.Radio(["facebook/musicgen-melody", "facebook/musicgen-medium", "facebook/musicgen-small",
282
+ "facebook/musicgen-large",
283
+ "facebook/musicgen-melody-large",
284
+ "facebook/musicgen-stereo-small", "facebook/musicgen-stereo-medium",
285
+ "facebook/musicgen-stereo-melody", "facebook/musicgen-stereo-large",
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')