From 72685d0398a2923241a8055fade1fd2dbf17a77d Mon Sep 17 00:00:00 2001 From: awerks Date: Wed, 16 Aug 2023 16:15:24 +0200 Subject: [PATCH] Update asr.py --- whisperx/asr.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/whisperx/asr.py b/whisperx/asr.py index ba65a95..8b1e5ca 100644 --- a/whisperx/asr.py +++ b/whisperx/asr.py @@ -247,7 +247,7 @@ class FasterWhisperPipeline(Pipeline): return final_iterator def transcribe( - self, audio: Union[str, np.ndarray], batch_size=None, num_workers=0, language=None, task=None + self, audio: Union[str, np.ndarray], batch_size=None, num_workers=0, language=None, task=None, print_progress = False ) -> TranscriptionResult: if isinstance(audio, str): audio = load_audio(audio) @@ -287,8 +287,9 @@ class FasterWhisperPipeline(Pipeline): batch_size = batch_size or self._batch_size total_segments = len(vad_segments) for idx, out in enumerate(self.__call__(data(audio, vad_segments), batch_size=batch_size, num_workers=num_workers)): - percent_complete = ((idx + 1) / total_segments) * 100 - print(f"Progress: {percent_complete:.2f}%...") + if print_progress: + percent_complete = ((idx + 1) / total_segments) * 100 + print(f"Progress: {percent_complete:.2f}%...") text = out['text'] if batch_size in [0, 1, None]: text = text[0]