Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
from huggingsound import SpeechRecognitionModel
|
3 |
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
4 |
from transformers import pipeline
|
@@ -6,9 +7,14 @@ from transformers import pipeline
|
|
6 |
# Función para convertir la tasa de muestreo del audio de entrada
|
7 |
def modelo1(audio):
|
8 |
# Convertir la tasa de muestreo del audio
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
12 |
return text
|
13 |
|
14 |
def modelo2(text):
|
|
|
1 |
import gradio as gr
|
2 |
+
import numpy as np
|
3 |
from huggingsound import SpeechRecognitionModel
|
4 |
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
|
5 |
from transformers import pipeline
|
|
|
7 |
# Función para convertir la tasa de muestreo del audio de entrada
|
8 |
def modelo1(audio):
|
9 |
# Convertir la tasa de muestreo del audio
|
10 |
+
audio_data, sample_rate = audio
|
11 |
+
# Asegurarse de que audio_data sea un array NumPy
|
12 |
+
if not isinstance(audio_data, np.ndarray):
|
13 |
+
audio_data = np.array(audio_data)
|
14 |
+
|
15 |
+
# Utilizar audio_data como entrada para el modelo
|
16 |
+
whisper = pipeline('automatic-speech-recognition', model='openai/whisper-medium', device=-1) # Cambia 'device' a -1 para usar la CPU
|
17 |
+
text = whisper(audio_data)
|
18 |
return text
|
19 |
|
20 |
def modelo2(text):
|