vmasmitja
commited on
Commit
路
bb25137
1
Parent(s):
3696e80
Fix app initialization issue
Browse files
app.py
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
# Cargar el modelo de transcripci贸n Whisper
|
| 5 |
+
transcriber = pipeline("automatic-speech-recognition", model="openai/whisper-small")
|
| 6 |
+
|
| 7 |
+
# Funci贸n para transcribir audio
|
| 8 |
+
def transcribe(audio):
|
| 9 |
+
result = transcriber(audio)
|
| 10 |
+
return result["text"]
|
| 11 |
+
|
| 12 |
+
# Crear interfaz Gradio
|
| 13 |
+
demo = gr.Interface(
|
| 14 |
+
fn=transcribe,
|
| 15 |
+
inputs=gr.Audio(source="upload", type="filepath"),
|
| 16 |
+
outputs="text",
|
| 17 |
+
title="Transcripci贸n de Audio en Vivo",
|
| 18 |
+
description="Sube un archivo de audio para transcribir su contenido autom谩ticamente."
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
# Lanzar la aplicaci贸n
|
| 22 |
+
if __name__ == "__main__":
|
| 23 |
+
demo.launch()
|