File size: 616 Bytes
25f917e 882e6d2 f34dac7 25f917e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
from transformers import pipeline
import gradio as gr
import time
pipe = pipeline(
model="dvislobokov/whisper-large-v3-turbo-russian",
tokenizer="dvislobokov/whisper-large-v3-turbo-russian",
task='automatic-speech-recognition',
device='cpu'
)
def transcribe(audio):
start = time.time()
text = pipe(audio, return_timestamps=True)['text']
spent_time = (time.time() - start)
return f'Spent time: {spent_time}\nText: {text}'
iface = gr.Interface(
fn=transcribe,
inputs=gr.Audio(sources=['microphone', 'upload'], type='filepath'),
outputs='text'
)
iface.launch(share=True)
|