import gradio as gr import scipy from diffusers import DiffusionPipeline model_id = "harmonai/maestro-150k" pipeline = DiffusionPipeline.from_pretrained(model_id) pipeline = pipeline.to("cuda") def denoise(length_sec): audios = pipeline(audio_length_in_s=length_sec).audios for audio in audios: scipy.io.wavfile.write("maestro_test.wav", pipe.unet.sample_rate, audio.transpose()) return "maestro_test.wav" gr.Interface(fn=denoise, inputs=gr.Slider(1.0, 6.0, value=3.0, step=0.5, label="Audio length in seconds"), outputs="audio").launch()