Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,15 +10,14 @@ else:
|
|
10 |
device = "cpu"
|
11 |
torch_dtype = torch.float32
|
12 |
|
13 |
-
midi = PrettyMIDI("test.mid")
|
14 |
-
|
15 |
controlnet = ControlNetModel.from_pretrained("lauraibnz/midi-audioldm", torch_dtype=torch_dtype)
|
16 |
pipe = AudioLDMControlNetPipeline.from_pretrained("cvssp/audioldm-m-full", controlnet=controlnet, torch_dtype=torch_dtype)
|
17 |
pipe = pipe.to(device)
|
18 |
|
19 |
-
def predict(prompt,
|
|
|
20 |
audio = pipe(prompt, midi=midi, audio_length_in_s=audio_length_in_s, num_inference_steps=num_inference_steps, controlnet_conditioning_scale=controlnet_conditioning_scale)
|
21 |
return audio
|
22 |
|
23 |
-
demo = gr.Interface(fn=predict, inputs="
|
24 |
demo.launch()
|
|
|
10 |
device = "cpu"
|
11 |
torch_dtype = torch.float32
|
12 |
|
|
|
|
|
13 |
controlnet = ControlNetModel.from_pretrained("lauraibnz/midi-audioldm", torch_dtype=torch_dtype)
|
14 |
pipe = AudioLDMControlNetPipeline.from_pretrained("cvssp/audioldm-m-full", controlnet=controlnet, torch_dtype=torch_dtype)
|
15 |
pipe = pipe.to(device)
|
16 |
|
17 |
+
def predict(prompt, midi_file="test.mid", audio_length_in_s=10, num_inference_steps=20, controlnet_conditioning_scale=1.0):
|
18 |
+
midi = PrettyMIDI(midi_file)
|
19 |
audio = pipe(prompt, midi=midi, audio_length_in_s=audio_length_in_s, num_inference_steps=num_inference_steps, controlnet_conditioning_scale=controlnet_conditioning_scale)
|
20 |
return audio
|
21 |
|
22 |
+
demo = gr.Interface(fn=predict, inputs="text", outputs="audio")
|
23 |
demo.launch()
|