Spaces:
Sleeping
Sleeping
Create app.py
Browse filesDe Audio a Texto
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()
|