Commit
·
25f917e
1
Parent(s):
9bb8853
Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
import gradio as gr
|
3 |
+
import time
|
4 |
+
|
5 |
+
pipe = pipeline(
|
6 |
+
model="dvislobokov/whisper-large-v3-turbo-russian",
|
7 |
+
tokenizer="dvislobokov/whisper-large-v3-turbo-russian",
|
8 |
+
task='automatic-speech-recognition',
|
9 |
+
device='cpu'
|
10 |
+
)
|
11 |
+
|
12 |
+
def transcribe(audio):
|
13 |
+
start = time.time()
|
14 |
+
text = pipe(audio)['text']
|
15 |
+
print(time.time() - start)
|
16 |
+
return text
|
17 |
+
|
18 |
+
iface = gr.Interface(
|
19 |
+
fn=transcribe,
|
20 |
+
inputs=gr.Audio(sources=['microphone', 'upload'], type='filepath'),
|
21 |
+
outputs='text'
|
22 |
+
)
|
23 |
+
|
24 |
+
iface.launch(share=True)
|