ysharma HF staff commited on
Commit
8f045d7
1 Parent(s): 6e17fca
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -32,10 +32,11 @@ def whisper_stt(audio):
32
 
33
  # detect the spoken language
34
  _, probs = model.detect_language(mel)
 
35
  print(f"Detected language: {max(probs, key=probs.get)}")
36
 
37
  # decode the audio
38
- options = whisper.DecodingOptions(fp16 = False)
39
  result = whisper.decode(model, mel, options)
40
 
41
  # print the recognized text
 
32
 
33
  # detect the spoken language
34
  _, probs = model.detect_language(mel)
35
+ lang = max(probs, key=probs.get)
36
  print(f"Detected language: {max(probs, key=probs.get)}")
37
 
38
  # decode the audio
39
+ options = whisper.DecodingOptions(fp16 = False, language=lang)
40
  result = whisper.decode(model, mel, options)
41
 
42
  # print the recognized text