Fix bug when using skip_gaps or expand_into_gaps

#4
by GkevinOD - opened
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -109,11 +109,11 @@ class WhisperTranscriber:
109
  elif (vad == 'silero-vad-skip-gaps'):
110
  # Silero VAD where non-speech gaps are simply ignored
111
  skip_gaps = self._create_silero_config(NonSpeechStrategy.SKIP, vadMergeWindow, vadMaxMergeSize, vadPadding, vadPromptWindow)
112
- result = skip_gaps.transcribe(audio_path, whisperCallable, skip_gaps)
113
  elif (vad == 'silero-vad-expand-into-gaps'):
114
  # Use Silero VAD where speech-segments are expanded into non-speech gaps
115
  expand_gaps = self._create_silero_config(NonSpeechStrategy.EXPAND_SEGMENT, vadMergeWindow, vadMaxMergeSize, vadPadding, vadPromptWindow)
116
- result = expand_gaps.transcribe(audio_path, whisperCallable, expand_gaps)
117
  elif (vad == 'periodic-vad'):
118
  # Very simple VAD - mark every 5 minutes as speech. This makes it less likely that Whisper enters an infinite loop, but
119
  # it may create a break in the middle of a sentence, causing some artifacts.
 
109
  elif (vad == 'silero-vad-skip-gaps'):
110
  # Silero VAD where non-speech gaps are simply ignored
111
  skip_gaps = self._create_silero_config(NonSpeechStrategy.SKIP, vadMergeWindow, vadMaxMergeSize, vadPadding, vadPromptWindow)
112
+ result = self.vad_model.transcribe(audio_path, whisperCallable, skip_gaps)
113
  elif (vad == 'silero-vad-expand-into-gaps'):
114
  # Use Silero VAD where speech-segments are expanded into non-speech gaps
115
  expand_gaps = self._create_silero_config(NonSpeechStrategy.EXPAND_SEGMENT, vadMergeWindow, vadMaxMergeSize, vadPadding, vadPromptWindow)
116
+ result = self.vad_model.transcribe(audio_path, whisperCallable, expand_gaps)
117
  elif (vad == 'periodic-vad'):
118
  # Very simple VAD - mark every 5 minutes as speech. This makes it less likely that Whisper enters an infinite loop, but
119
  # it may create a break in the middle of a sentence, causing some artifacts.