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

modelo = pipeline("automatic-speech-recognition", model = "facebook/wav2vec2-large-xlsr-53-spanish")
title = "Speech2Text (Spanish)"
description = "Record an audio and convert it to text (Spanish)"

def transcribe(audio):
  text = modelo(audio)["text"]
  return text


gr.Interface(
    fn = transcribe,
    inputs = [gr.Audio(source="microphone", type = "filepath")],
    outputs = ["textbox"],
    title = title,
    description = description
).launch()