huedaya commited on
Commit
1657f8c
1 Parent(s): d87a330

Update run.py

Browse files
Files changed (1) hide show
  1. run.py +10 -2
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="openai/whisper-base.en")
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({"sampling_rate": sr, "raw": stream})["text"]
 
 
 
 
 
 
 
 
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(