File size: 763 Bytes
d0eea62
014c294
 
d0eea62
014c294
 
6fd1262
d0eea62
014c294
 
6fd1262
014c294
 
 
 
6fd1262
014c294
 
6fd1262
014c294
 
 
 
6fd1262
014c294
 
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
import gradio as gr
import torch
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler


def modelo1(audio):
    return gr.Interface.load("models/jonatasgrosman/wav2vec2-large-xlsr-53-english")

def modelo2(text):
    model_id = "stabilityai/stable-diffusion-2-1"

    # Use the DPMSolverMultistepScheduler (DPM-Solver++) scheduler here instead
    pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
    pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
    pipe = pipe.to("cuda")

    image = pipe(text).images[0]
    

def execution(audio):
    modelo1res = modelo1(audio)
    modelo2res = modelo2(modelo1res)
    return modelo1res

if __name__ == "__main__":
    demo.launch()