From 610f82ffba57540caac71147c28571ec6e362ced Mon Sep 17 00:00:00 2001 From: Kent Slaney Date: Sun, 21 Jul 2024 20:21:02 -0700 Subject: [PATCH] remove realtime-specific code --- whisper/transcribe.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/whisper/transcribe.py b/whisper/transcribe.py index 069c5ed..aaf261a 100644 --- a/whisper/transcribe.py +++ b/whisper/transcribe.py @@ -734,24 +734,6 @@ class Transcriber(metaclass=PassthroughPropertyDefaults): def reporthook(self) -> None: pass - def restore(self, offset: int) -> None: - processing, seconds = 0, offset * HOP_LENGTH / SAMPLE_RATE - while len(self.all_segments) > 0 and ( - self.all_segments[-1]["start"] >= seconds - if len(self.all_segments) == 1 - else self.all_segments[-2]["end"] > seconds - ): - rewriting = self.all_segments.pop() - processing += len(rewriting["tokens"]) - self.all_tokens = self.all_tokens[: len(self.all_tokens) - processing] - if len(self.all_segments) > 0 and ( - self.all_segments[-1]["start"] < seconds - and self.all_segments[-1]["end"] >= seconds - ): - self.seek = round(self.all_segments[-1]["end"] * SAMPLE_RATE / HOP_LENGTH) - else: - self.seek = offset - class InMemoryAudio(AudioFile): dft_pad = True