File size: 473 Bytes
1e1197e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from transformers import pipeline
import gradio as gr

# Cargar el modelo de reconocimiento automático de voz
modelo = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-large-xlsr-53-spanish")

def transcribe(audio):
    # Transcribir el audio a texto usando el modelo
    text = modelo(audio)["text"]
    return text

# Crear la interfaz de Gradio
gr.Interface(
    fn=transcribe,
    inputs=gr.Audio(type="filepath"),
    outputs=gr.Textbox()
).launch()