reach-vb HF staff commited on
Commit
2d0d9bb
1 Parent(s): 9363379
Files changed (1) hide show
  1. app.py +3 -0
app.py CHANGED
@@ -6,6 +6,7 @@ from transformers import pipeline
6
  from huggingface_hub import model_info
7
 
8
  MODEL_NAME = "openai/whisper-small" #this always needs to stay in line 8 :D sorry for the hackiness
 
9
 
10
  device = 0 if torch.cuda.is_available() else "cpu"
11
 
@@ -16,6 +17,8 @@ pipe = pipeline(
16
  device=device,
17
  )
18
 
 
 
19
  def transcribe(microphone, file_upload):
20
  warn_output = ""
21
  if (microphone is not None) and (file_upload is not None):
 
6
  from huggingface_hub import model_info
7
 
8
  MODEL_NAME = "openai/whisper-small" #this always needs to stay in line 8 :D sorry for the hackiness
9
+ lang = "en"
10
 
11
  device = 0 if torch.cuda.is_available() else "cpu"
12
 
 
17
  device=device,
18
  )
19
 
20
+ pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
21
+
22
  def transcribe(microphone, file_upload):
23
  warn_output = ""
24
  if (microphone is not None) and (file_upload is not None):