File size: 561 Bytes
6374438
867ecba
3d49697
6374438
3d49697
 
 
6374438
4a0f7d0
 
3b696cf
 
867ecba
3d49697
4a0f7d0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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()