Spaces:
Sleeping
Sleeping
Update app.py
Browse filesFor ease of private usage, a duplicate button has been added.
I have used a bit of blocks API and have also added some css to center the button.
app.py
CHANGED
@@ -231,6 +231,7 @@ def gradio_generate(prompt, steps, guidance):
|
|
231 |
return output_filename
|
232 |
|
233 |
|
|
|
234 |
description_text = """
|
235 |
<p><a href="https://huggingface.co/spaces/declare-lab/mustango/blob/main/app.py?duplicate=true"> <img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a> For faster inference without waiting in queue, you may duplicate the space and upgrade to a GPU in the settings. <br/><br/>
|
236 |
Generate music using Mustango by providing a text prompt.
|
@@ -246,12 +247,21 @@ output_audio = gr.Audio(label="Generated Music", type="filepath")
|
|
246 |
denoising_steps = gr.Slider(minimum=100, maximum=200, value=100, step=1, label="Steps", interactive=True)
|
247 |
guidance_scale = gr.Slider(minimum=1, maximum=10, value=3, step=0.1, label="Guidance Scale", interactive=True)
|
248 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
249 |
# Gradio interface
|
250 |
gr_interface = gr.Interface(
|
251 |
fn=gradio_generate,
|
252 |
inputs=[input_text, denoising_steps, guidance_scale],
|
253 |
outputs=[output_audio],
|
254 |
-
title="Mustango: Toward Controllable Text-to-Music Generation",
|
255 |
description=description_text,
|
256 |
allow_flagging=False,
|
257 |
examples=[
|
@@ -265,6 +275,11 @@ gr_interface = gr.Interface(
|
|
265 |
cache_examples=False,
|
266 |
)
|
267 |
|
|
|
|
|
|
|
|
|
|
|
|
|
268 |
# Launch Gradio app
|
269 |
-
|
270 |
-
gr_interface.launch()
|
|
|
231 |
return output_filename
|
232 |
|
233 |
|
234 |
+
title="Mustango: Toward Controllable Text-to-Music Generation"
|
235 |
description_text = """
|
236 |
<p><a href="https://huggingface.co/spaces/declare-lab/mustango/blob/main/app.py?duplicate=true"> <img style="margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a> For faster inference without waiting in queue, you may duplicate the space and upgrade to a GPU in the settings. <br/><br/>
|
237 |
Generate music using Mustango by providing a text prompt.
|
|
|
247 |
denoising_steps = gr.Slider(minimum=100, maximum=200, value=100, step=1, label="Steps", interactive=True)
|
248 |
guidance_scale = gr.Slider(minimum=1, maximum=10, value=3, step=0.1, label="Guidance Scale", interactive=True)
|
249 |
|
250 |
+
# CSS styling for the Duplicate button
|
251 |
+
css = '''
|
252 |
+
#duplicate-button {
|
253 |
+
margin: auto;
|
254 |
+
color: white;
|
255 |
+
background: #1565c0;
|
256 |
+
border-radius: 100vh;
|
257 |
+
}
|
258 |
+
'''
|
259 |
+
|
260 |
# Gradio interface
|
261 |
gr_interface = gr.Interface(
|
262 |
fn=gradio_generate,
|
263 |
inputs=[input_text, denoising_steps, guidance_scale],
|
264 |
outputs=[output_audio],
|
|
|
265 |
description=description_text,
|
266 |
allow_flagging=False,
|
267 |
examples=[
|
|
|
275 |
cache_examples=False,
|
276 |
)
|
277 |
|
278 |
+
with gr.Blocks(css=css) as demo:
|
279 |
+
title=gr.HTML(f"<h1><center>{title}</center></h1>")
|
280 |
+
dupe = gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
|
281 |
+
gr_interface.render()
|
282 |
+
|
283 |
+
|
284 |
# Launch Gradio app
|
285 |
+
demo.queue().launch()
|
|