Neilblaze commited on
Commit
ee907fe
·
1 Parent(s): 1887a86

fix: translation err's

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -18,16 +18,14 @@ def transcribe(audio):
18
  print(f"Detected language: {max(probs, key=probs.get)}")
19
 
20
  # decode the audio
21
- options = whisper.DecodingOptions(fp16 = False)
22
  result = whisper.decode(model, mel, options)
23
- # translate the result to english
24
- newresult = whisper.translate(result, "en")
25
- return newresult.text
26
 
27
 
28
 
29
  gr.Interface(
30
- title = 'OpenAI Whisper ASR Gradio Web UI',
31
  fn=transcribe,
32
  inputs=[
33
  gr.inputs.Audio(source="microphone", type="filepath")
 
18
  print(f"Detected language: {max(probs, key=probs.get)}")
19
 
20
  # decode the audio
21
+ options = whisper.DecodingOptions(fp16 = False, task = "translate")
22
  result = whisper.decode(model, mel, options)
23
+ return result.text
 
 
24
 
25
 
26
 
27
  gr.Interface(
28
+ title = 'WhisperAnything — OpenAI Whisper ASR to EN',
29
  fn=transcribe,
30
  inputs=[
31
  gr.inputs.Audio(source="microphone", type="filepath")