Hugomartinezg commited on
Commit
1e1197e
·
verified ·
1 Parent(s): 8f4fba8

Create app.py

Browse files

De Audio a Texto

Files changed (1) hide show
  1. app.py +17 -0
app.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline
2
+ import gradio as gr
3
+
4
+ # Cargar el modelo de reconocimiento automático de voz
5
+ modelo = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-large-xlsr-53-spanish")
6
+
7
+ def transcribe(audio):
8
+ # Transcribir el audio a texto usando el modelo
9
+ text = modelo(audio)["text"]
10
+ return text
11
+
12
+ # Crear la interfaz de Gradio
13
+ gr.Interface(
14
+ fn=transcribe,
15
+ inputs=gr.Audio(type="filepath"),
16
+ outputs=gr.Textbox()
17
+ ).launch()