File size: 831 Bytes
72c877e
 
 
 
c17b696
72c877e
c17b696
72c877e
 
 
 
 
 
 
 
c17b696
72c877e
c17b696
d021b1c
72c877e
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import argparse

import gradio as gr

from audiodiffusion import AudioDiffusion

audio_diffusion = AudioDiffusion()

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("--port", type=int)
    parser.add_argument("--server", type=int)
    args = parser.parse_args()

    demo = gr.Interface(
        fn=audio_diffusion.generate_spectrogram_and_audio,
        title="Audio Diffusion",
        description="Generate audio using Huggingface diffusers.\
            This takes about 20 minutes without a GPU, so why not make yourself a cup of tea in the meantime?",
        inputs=[],
        outputs=[
            gr.Image(label="Mel spectrogram", image_mode="L"),
            gr.Audio(label="Audio"),
        ],
    )
    demo.launch(server_name=args.server or "0.0.0.0", server_port=args.port)