File size: 623 Bytes
3737b65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Let's get pipelines from transformers
from transformers import pipeline
# Let's import Gradio
import gradio as gr

# Let's set up the model
model = pipeline("automatic-speech-recognition", model="facebook/wav2vec2-large-xlsr-53-spanish")
title = "Audio2Text"
description = "Record your audio in Spanish and send it in order to received a transcription"


# Function
def transcribe(audio):
  # Let's invoke "model" defined above
  text = model(audio)["text"]
  return text


# Interface Set-Up
gr.Interface(
    fn=transcribe,
    inputs=[gr.Audio(source="microphone", type="filepath")],
    outputs=["textbox"]
).launch()