diff --git a/whisper/transcribe.py b/whisper/transcribe.py index 97bb2d6..a963930 100644 --- a/whisper/transcribe.py +++ b/whisper/transcribe.py @@ -363,7 +363,8 @@ def transcribe( for i, segment in enumerate(current_segments, start=len(all_segments)): if not segment['text'].strip(): continue - if len(all_prompts_segments) > 0 and all_prompts_segments[-1]['text'].strip() == segment['text'].strip(): + check_prompt_num = 1 + if any([prev['text'].strip() == segment['text'].strip() for prev in all_prompts_segments[-check_prompt_num:]]): continue all_prompts_tokens.extend(segment['tokens']) all_prompts_segments.append({"id": i, **segment})