|
import gradio as gr |
|
from transformers import pipeline |
|
|
|
p = pipeline("automatic-speech-recognition", model="techiaith/wav2vec2-xlsr-ft-cy", decoder = "Wav2Vec2ProcessorWithLM") |
|
|
|
def transcribe(audio): |
|
text = p(audio)["text"] |
|
return text |
|
|
|
demo = gr.Interface( |
|
fn=transcribe, |
|
title="Adnabod Lleferydd Cymraeg // Welsh Automatic Speech Recognition", |
|
description="Recordiwch eich hunain gyda'ch meicroffon yn dweud rhywbeth yn Gymraeg ac fe ddangosir yr AI drawsgrifiad o beth dywedoch. // Record yourself with your microphone saying something in Welsh 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() |
|
|