Spaces:
Runtime error
Runtime error
Hide hint when it is useless
Browse files- demos/musicgen_app.py +9 -3
demos/musicgen_app.py
CHANGED
@@ -240,6 +240,10 @@ 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(
|
@@ -251,6 +255,7 @@ def ui_full(launch_kwargs):
|
|
251 |
Derived from <a href="https://github.com/facebookresearch/audiocraft">MusicGen</a>,
|
252 |
presented at: <a href="https://huggingface.co/papers/2306.05284">"Simple and Controllable Music Generation"</a>.
|
253 |
MusicGen gets better results than other AIs like WaveFormer.
|
|
|
254 |
You can duplicate this space on a free account, it works on CPU.
|
255 |
<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>
|
256 |
|
@@ -290,12 +295,13 @@ def ui_full(launch_kwargs):
|
|
290 |
# Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
|
291 |
_ = gr.Button("Abort all", variant="stop").click(fn=interrupt, queue = False)
|
292 |
with gr.Column():
|
293 |
-
output_hint = gr.Label("To download the output, right-click and click on Save as...")
|
294 |
-
output = gr.Video(label="Generated Music"
|
295 |
-
audio_output = gr.Audio(label="Generated Music (wav)", type='filepath', show_download_button = True)
|
296 |
diffusion_output = gr.Video(label="MultiBand Diffusion Decoder")
|
297 |
audio_diffusion = gr.Audio(label="MultiBand Diffusion Decoder (wav)", type='filepath')
|
298 |
submit.click(toggle_diffusion, decoder, [diffusion_output, audio_diffusion], queue=False,
|
|
|
299 |
show_progress=False).then(predict_full, inputs=[model, model_path, decoder, text, melody, duration, topk, topp,
|
300 |
temperature, cfg_coef],
|
301 |
outputs=[output, audio_output, diffusion_output, audio_diffusion])
|
|
|
240 |
return [gr.update(visible=False)] * 2
|
241 |
|
242 |
|
243 |
+
def toggle_output_hint(isVisible):
|
244 |
+
return [gr.update(visible = isVisible)]
|
245 |
+
|
246 |
+
|
247 |
def ui_full(launch_kwargs):
|
248 |
with gr.Blocks() as interface:
|
249 |
gr.Markdown(
|
|
|
255 |
Derived from <a href="https://github.com/facebookresearch/audiocraft">MusicGen</a>,
|
256 |
presented at: <a href="https://huggingface.co/papers/2306.05284">"Simple and Controllable Music Generation"</a>.
|
257 |
MusicGen gets better results than other AIs like WaveFormer.
|
258 |
+
If you are looking for sound effect rather than music, I recommend you AudioGen or AudioLDM2.
|
259 |
You can duplicate this space on a free account, it works on CPU.
|
260 |
<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>
|
261 |
|
|
|
295 |
# Adapted from https://github.com/rkfg/audiocraft/blob/long/app.py, MIT license.
|
296 |
_ = gr.Button("Abort all", variant="stop").click(fn=interrupt, queue = False)
|
297 |
with gr.Column():
|
298 |
+
output_hint = gr.Label("To download the output, right-click and click on Save as...", label = "To download the output, right-click and click on Save as...")
|
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 |
diffusion_output = gr.Video(label="MultiBand Diffusion Decoder")
|
302 |
audio_diffusion = gr.Audio(label="MultiBand Diffusion Decoder (wav)", type='filepath')
|
303 |
submit.click(toggle_diffusion, decoder, [diffusion_output, audio_diffusion], queue=False,
|
304 |
+
show_progress=False).then(toggle_output_hint, False, [output_hint], queue=False,
|
305 |
show_progress=False).then(predict_full, inputs=[model, model_path, decoder, text, melody, duration, topk, topp,
|
306 |
temperature, cfg_coef],
|
307 |
outputs=[output, audio_output, diffusion_output, audio_diffusion])
|