Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -62,22 +62,23 @@ with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.the
|
|
62 |
"""
|
63 |
MIDI-AudioLDM is a MIDI-conditioned text-to-audio model based on the project [AudioLDM](https://huggingface.co/spaces/haoheliu/audioldm-text-to-audio-generation). The model has been conditioned using the ControlNet architecture and has been developed within Hugging Face’s [🧨 Diffusers](https://huggingface.co/docs/diffusers/) framework. Once trained, MIDI-AudioLDM accepts a MIDI file and a text prompt as input and returns an audio file, which is an interpretation of the MIDI based on the given text description. This enables detailed control over different musical aspects such as notes, mood and timbre.
|
64 |
""")
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
with gr.
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
81 |
btn = gr.Button("Generate")
|
82 |
btn.click(predict, inputs=[midi, prompt, neg_prompt, duration, seed, cond, inf, guidance_scale, guess], outputs=[audio])
|
83 |
gr.Examples(examples=[["S00.mid", "piano", "", 10, 25, 1.0, 20, 2.5, False], ["S00.mid", "violin", "", 10, 25, 1.0, 20, 2.5, False], ["S00.mid", "woman singing, studio recording", "noise", 10, 25, 1.0, 20, 2.5, False], ["S00.mid", "jazz band, clean", "noise", 10, 25, 0.8, 20, 2.5, False], ["S00.mid", "choir", "noise, percussion", 10, 25, 0.7, 20, 2.5, False]], inputs=[midi, prompt, neg_prompt, duration, seed, cond, inf, guidance_scale, guess], fn=run_example, outputs=[midi_synth, audio], cache_examples=True)
|
|
|
62 |
"""
|
63 |
MIDI-AudioLDM is a MIDI-conditioned text-to-audio model based on the project [AudioLDM](https://huggingface.co/spaces/haoheliu/audioldm-text-to-audio-generation). The model has been conditioned using the ControlNet architecture and has been developed within Hugging Face’s [🧨 Diffusers](https://huggingface.co/docs/diffusers/) framework. Once trained, MIDI-AudioLDM accepts a MIDI file and a text prompt as input and returns an audio file, which is an interpretation of the MIDI based on the given text description. This enables detailed control over different musical aspects such as notes, mood and timbre.
|
64 |
""")
|
65 |
+
with gr.Column(variant='panel'):
|
66 |
+
midi = gr.File(label="midi file", file_types=[".mid"])
|
67 |
+
prompt = gr.Textbox(label="prompt", info="Enter a descriptive text prompt to guide the audio generation.")
|
68 |
+
with gr.Row():
|
69 |
+
with gr.Column():
|
70 |
+
midi_synth = gr.Audio(label="synthesized midi")
|
71 |
+
midi.upload(synthesize, midi, midi_synth)
|
72 |
+
with gr.Column():
|
73 |
+
audio = gr.Audio(label="generated audio")
|
74 |
+
with gr.Accordion("Advanced Settings", open=False):
|
75 |
+
duration = gr.Slider(0, 30, value=10, step=2.5, label="duration", info="Modify the duration in seconds of the output audio file.")
|
76 |
+
inf = gr.Slider(0, 50, value=20, step=1, label="inference steps", info="Edit the number of denoising steps. A larger number usually leads to higher quality but slower results.")
|
77 |
+
guidance_scale = gr.Slider(0, 4, value=2.5, step=0.5, label="guidance scale", info="Modify the guidance scale. The higher the value the more linked the generated audio to the text prompt, sometimes at the expense of lower quality.")
|
78 |
+
neg_prompt = gr.Textbox(label="negative prompt", info="Optionally enter a negative text prompt not to guide the audio generation.")
|
79 |
+
seed = gr.Number(value=25, label="random seed", info="Change the random seed for a different generation result.")
|
80 |
+
cond = gr.Slider(0.0, 1.0, value=1.0, step=0.1, label="conditioning scale", info="Choose a value between 0 and 1. The larger the more it will take the conditioning into account. Lower values are recommended for more creative prompts.")
|
81 |
+
guess = gr.Checkbox(label="guess mode", info="Optionally select guess mode. If so, the model will try to recognize the content of the MIDI without the need of a text prompt.")
|
82 |
btn = gr.Button("Generate")
|
83 |
btn.click(predict, inputs=[midi, prompt, neg_prompt, duration, seed, cond, inf, guidance_scale, guess], outputs=[audio])
|
84 |
gr.Examples(examples=[["S00.mid", "piano", "", 10, 25, 1.0, 20, 2.5, False], ["S00.mid", "violin", "", 10, 25, 1.0, 20, 2.5, False], ["S00.mid", "woman singing, studio recording", "noise", 10, 25, 1.0, 20, 2.5, False], ["S00.mid", "jazz band, clean", "noise", 10, 25, 0.8, 20, 2.5, False], ["S00.mid", "choir", "noise, percussion", 10, 25, 0.7, 20, 2.5, False]], inputs=[midi, prompt, neg_prompt, duration, seed, cond, inf, guidance_scale, guess], fn=run_example, outputs=[midi_synth, audio], cache_examples=True)
|