File size: 579 Bytes
51f83c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import torch
import torchaudio
from transformers import pipeline

# Cargar modelo de transcripción (Whisper)
pipe = pipeline("automatic-speech-recognition", model="openai/whisper-small")

def transcribir(audio):
    text = pipe(audio)["text"]
    return text

# Crear interfaz con Gradio
demo = gr.Interface(
    fn=transcribir,
    inputs=gr.Audio(type="filepath", label="Sube tu audio"),
    outputs="text",
    title="Transcripción de Voz",
    description="Este Space usa Whisper (openai/whisper-small) para convertir audio en texto.",
)

demo.launch()