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