manu commited on
Commit
713c934
β€’
1 Parent(s): 0eecd9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -15,6 +15,7 @@ passage = wikipedia.summary("pirate code", sentences=2)
15
  def inference(audio):
16
  audio = whisper.load_audio(audio)
17
  audio = whisper.pad_or_trim(audio)
 
18
 
19
  mel = whisper.log_mel_spectrogram(audio).to(model.device)
20
 
@@ -41,7 +42,7 @@ def inference(audio):
41
  print(result.text)
42
  print(passage)
43
 
44
- return f"WER is {error * len(result.text.split())} \n\n{result.text}", gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
45
 
46
 
47
 
 
15
  def inference(audio):
16
  audio = whisper.load_audio(audio)
17
  audio = whisper.pad_or_trim(audio)
18
+ audio_length = audio.shape[-1]/16000
19
 
20
  mel = whisper.log_mel_spectrogram(audio).to(model.device)
21
 
 
42
  print(result.text)
43
  print(passage)
44
 
45
+ return f"For a {audio_length} second audio, WER is {error * len(result.text.split())} \n\n{result.text} resulting in a final time of {audio_length + error * len(result.text.split())}", gr.update(visible=True), gr.update(visible=True), gr.update(visible=True)
46
 
47
 
48