lauraibnz commited on
Commit
fbbf776
1 Parent(s): f91f697

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -39
app.py CHANGED
@@ -33,45 +33,45 @@ def predict(midi_file=None, prompt="", negative_prompt="", audio_length_in_s=5,
33
  )
34
  return (16000, audio.audios.T)
35
 
36
- with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])) as demo:
37
- gr.Markdown(
38
- """
39
- # MIDI-AudioLDM
40
- 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 inputs 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.
41
- """)
42
- with gr.Row():
43
- with gr.Column():
44
- midi = gr.File(label="midi file", file_types=[".mid"])
45
- prompt = gr.Textbox(label="prompt")
46
- neg_prompt = gr.Textbox(label="negative prompt")
47
- with gr.Accordion("Advanced settings", open=False):
48
- duration = gr.Slider(0, 30, value=5, step=5, label="duration (seconds)")
49
- seed = gr.Number(value=42, label="seed")
50
- cond = gr.Slider(0.0, 1.0, value=1.0, step=0.1, label="conditioning scale")
51
- inf = gr.Slider(0, 50, value=20, step=0.1, label="inference steps")
52
- guess = gr.Checkbox(label="guess mode")
53
- with gr.Column():
54
- audio = gr.Audio(label="audio")
55
- btn = gr.Button("Generate")
56
- btn.click(predict, inputs=[midi, prompt, neg_prompt, duration, seed, cond, inf, guess], outputs=[audio])
57
  # gr.Examples=(examples=["S00.mid", "piano", "", 10, 25, 1.0, 20, False], input=[midi, prompt, neg_prompt, duration, seed, cond, inf, guess])
58
 
59
- # demo = gr.Interface(
60
- # fn=predict, inputs=[
61
- # gr.File(label="midi file", file_types=[".mid"]),
62
- # "text",
63
- # gr.Textbox(label="negative prompt"),
64
- # gr.Slider(0, 30, value=5, step=5, label="duration (seconds)"),
65
- # gr.Number(value=42, label="seed"),
66
- # gr.Slider(0.0, 1.0, value=1.0, step=0.1, label="conditioning scale"),
67
- # gr.Slider(0, 50, value=20, step=0.1, label="inference steps"),
68
- # gr.Checkbox(label="guess mode")
69
- # ],
70
- # outputs="audio",
71
- # examples=[["S00.mid", "piano", "", 10, 25, 1.0, 20, False]],
72
- # cache_examples=True,
73
- # title="🎹 MIDI-AudioLDM",
74
- # description="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 inputs 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.",
75
- # theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])
76
- # )
77
  demo.launch()
 
33
  )
34
  return (16000, audio.audios.T)
35
 
36
+ # with gr.Blocks(title="🎹 MIDI-AudioLDM", theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])) as demo:
37
+ # gr.Markdown(
38
+ # """
39
+ # # MIDI-AudioLDM
40
+ # 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 inputs 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.
41
+ # """)
42
+ # with gr.Row():
43
+ # with gr.Column():
44
+ # midi = gr.File(label="midi file", file_types=[".mid"])
45
+ # prompt = gr.Textbox(label="prompt")
46
+ # neg_prompt = gr.Textbox(label="negative prompt")
47
+ # with gr.Accordion("Advanced settings", open=False):
48
+ # duration = gr.Slider(0, 30, value=5, step=5, label="duration (seconds)")
49
+ # seed = gr.Number(value=42, label="seed")
50
+ # cond = gr.Slider(0.0, 1.0, value=1.0, step=0.1, label="conditioning scale")
51
+ # inf = gr.Slider(0, 50, value=20, step=0.1, label="inference steps")
52
+ # guess = gr.Checkbox(label="guess mode")
53
+ # with gr.Column():
54
+ # audio = gr.Audio(label="audio")
55
+ # btn = gr.Button("Generate")
56
+ # btn.click(predict, inputs=[midi, prompt, neg_prompt, duration, seed, cond, inf, guess], outputs=[audio])
57
  # gr.Examples=(examples=["S00.mid", "piano", "", 10, 25, 1.0, 20, False], input=[midi, prompt, neg_prompt, duration, seed, cond, inf, guess])
58
 
59
+ demo = gr.Interface(
60
+ fn=predict, inputs=[
61
+ gr.File(label="midi file", file_types=[".mid"]),
62
+ "text",
63
+ gr.Textbox(label="negative prompt"),
64
+ gr.Slider(0, 30, value=5, step=5, label="duration (seconds)"),
65
+ gr.Number(value=42, label="seed"),
66
+ gr.Slider(0.0, 1.0, value=1.0, step=0.1, label="conditioning scale"),
67
+ gr.Slider(0, 50, value=20, step=0.1, label="inference steps"),
68
+ gr.Checkbox(label="guess mode")
69
+ ],
70
+ outputs="audio",
71
+ examples=[["S00.mid", "piano", "", 10, 25, 1.0, 20, False]],
72
+ cache_examples=True,
73
+ title="🎹 MIDI-AudioLDM",
74
+ description="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 inputs 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.",
75
+ theme=gr.themes.Base(text_size=gr.themes.sizes.text_md, font=[gr.themes.GoogleFont("Nunito Sans")])
76
+ )
77
  demo.launch()