Spaces:
Runtime error
Runtime error
Update run.py
Browse files
run.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from transformers import pipeline
|
3 |
import numpy as np
|
4 |
|
5 |
-
transcriber = pipeline("automatic-speech-recognition", model="
|
6 |
|
7 |
def transcribe(stream, new_chunk):
|
8 |
sr, y = new_chunk
|
@@ -13,7 +13,15 @@ def transcribe(stream, new_chunk):
|
|
13 |
stream = np.concatenate([stream, y])
|
14 |
else:
|
15 |
stream = y
|
16 |
-
return stream, transcriber({
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
|
19 |
demo = gr.Interface(
|
|
|
2 |
from transformers import pipeline
|
3 |
import numpy as np
|
4 |
|
5 |
+
transcriber = pipeline("automatic-speech-recognition", model="NbAiLab/nb-whisper-tiny")
|
6 |
|
7 |
def transcribe(stream, new_chunk):
|
8 |
sr, y = new_chunk
|
|
|
13 |
stream = np.concatenate([stream, y])
|
14 |
else:
|
15 |
stream = y
|
16 |
+
return stream, transcriber({
|
17 |
+
"sampling_rate": sr,
|
18 |
+
"raw": stream,
|
19 |
+
|
20 |
+
}, generate_kwargs={
|
21 |
+
'num_beams': 5,
|
22 |
+
'task': 'transcribe',
|
23 |
+
'language': 'no'
|
24 |
+
})["text"]
|
25 |
|
26 |
|
27 |
demo = gr.Interface(
|