Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,29 +1,26 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
-
|
4 |
-
def
|
5 |
return gr.Interface.load("models/jonatasgrosman/wav2vec2-large-xlsr-53-english")
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
# Aquí utilizamos el modelo de estabilidad para procesar el texto
|
10 |
-
image = modelo_estabilidad(texto).images[0]
|
11 |
-
return image
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
modelo_estabilidad.scheduler = DPMSolverMultistepScheduler.from_config(modelo_estabilidad.scheduler.config)
|
18 |
-
modelo_estabilidad = modelo_estabilidad.to("cuda")
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
resultado_estabilidad = procesar_texto(resultado_audio, modelo_estabilidad)
|
23 |
-
return resultado_estabilidad
|
24 |
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
|
28 |
-
|
29 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
import torch
|
3 |
+
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
4 |
|
5 |
+
|
6 |
+
def modelo1(audio):
|
7 |
return gr.Interface.load("models/jonatasgrosman/wav2vec2-large-xlsr-53-english")
|
8 |
|
9 |
+
def modelo2(text):
|
10 |
+
model_id = "stabilityai/stable-diffusion-2-1"
|
|
|
|
|
|
|
11 |
|
12 |
+
# Use the DPMSolverMultistepScheduler (DPM-Solver++) scheduler here instead
|
13 |
+
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
|
14 |
+
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
15 |
+
pipe = pipe.to("cuda")
|
|
|
|
|
16 |
|
17 |
+
image = pipe(text).images[0]
|
18 |
+
|
|
|
|
|
19 |
|
20 |
+
def execution(audio):
|
21 |
+
modelo1res = modelo1(audio)
|
22 |
+
modelo2res = modelo2(modelo1res)
|
23 |
+
return modelo1res
|
24 |
|
25 |
+
if __name__ == "__main__":
|
26 |
+
demo.launch()
|