daihui.zhang
commited on
Commit
·
812e042
1
Parent(s):
9435daa
remove truncate in audio buffer
Browse files- transcribe/serve.py +0 -5
transcribe/serve.py
CHANGED
|
@@ -136,11 +136,6 @@ class WhisperTranscriptionService:
|
|
| 136 |
copy_length = min(len(audio_buffer), target_length)
|
| 137 |
silence_audio[-copy_length:] = audio_buffer[-copy_length:] # Copy from the end of audio_buffer
|
| 138 |
audio_buffer = silence_audio
|
| 139 |
-
elif len(audio_buffer) > self.sample_rate * config.MAX_SPEECH_DURATION_S:
|
| 140 |
-
# If buffer is too long even without padding, truncate it (optional, depends on desired behavior)
|
| 141 |
-
# This case might already be handled elsewhere, but good to consider
|
| 142 |
-
audio_buffer = audio_buffer[:int(self.sample_rate * config.MAX_SPEECH_DURATION_S)]
|
| 143 |
-
|
| 144 |
|
| 145 |
logger.debug(f"audio buffer size: {len(audio_buffer) / self.sample_rate:.2f}s")
|
| 146 |
meta_item = self._transcribe_audio(audio_buffer)
|
|
|
|
| 136 |
copy_length = min(len(audio_buffer), target_length)
|
| 137 |
silence_audio[-copy_length:] = audio_buffer[-copy_length:] # Copy from the end of audio_buffer
|
| 138 |
audio_buffer = silence_audio
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
logger.debug(f"audio buffer size: {len(audio_buffer) / self.sample_rate:.2f}s")
|
| 141 |
meta_item = self._transcribe_audio(audio_buffer)
|