File size: 827 Bytes
62af362
 
 
ef324ea
62af362
 
 
 
 
 
b933475
ef324ea
 
b933475
b536ea7
62af362
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from transformers import pipeline

p = pipeline("automatic-speech-recognition", model="DewiBrynJones/wav2vec2-xlsr-53-ft-ccv-en-cy", decoder = "Wav2Vec2ProcessorWithLM")

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

demo = gr.Interface(
    fn=transcribe,
    title="Adnabod Lleferydd Cymraeg a Saesneg // Welsh and English Automatic Speech Recognition",
    description="Recordiwch eich hunain gyda'ch meicroffon yn dweud rhywbeth yn Gymraeg neu Saesneg ac fe ddangosir yr AI drawsgrifiad o beth dywedoch. // Record yourself with your microphone saying something in Welsh or English and the AI will show you a transcript of what you said. ",
    inputs=gr.Audio(sources=["microphone"], type="filepath"),
    outputs=gr.Textbox(label="Trawsgrifiad // Transcription")
)

demo.launch()