|
from transformers import pipeline |
|
import gradio as gr |
|
import time |
|
|
|
pipe = pipeline("automatic-speech-recognition", model="Artanis1551/whisper_romanian3") |
|
|
|
|
|
def transcribe(rec=None, state=""): |
|
if rec is not None: |
|
audio = rec |
|
text = pipe(audio)["text"] |
|
state += text + ". " |
|
else: |
|
text = "" |
|
return text, state |
|
|
|
|
|
iface = gr.Interface( |
|
fn=transcribe, |
|
inputs=[gr.Audio(source="microphone", type="filepath", streaming=True), "state"], |
|
outputs=["text", "state"], |
|
title="Romanian Transcription Test", |
|
live=True, |
|
) |
|
|
|
|
|
iface.launch() |
|
|