Compare commits

...

3 Commits

Author SHA1 Message Date
9f24e2c735 Merge branch 'master' into prompt 2023-06-24 18:03:05 +08:00
9a646b69e6 format code 2023-04-20 02:00:57 +08:00
49af9564ab Ignore repeated prompt 2023-04-20 01:49:10 +08:00

View File

@@ -359,6 +359,7 @@ class WhisperModel:
idx = 0
seek = 0
all_tokens = []
all_prompt_text = []
prompt_reset_since = 0
if options.initial_prompt is not None:
@@ -533,8 +534,16 @@ class WhisperModel:
if segment["start"] == segment["end"] or not text.strip():
continue
all_tokens.extend(tokens)
idx += 1
check_prompt_num = 1
if all(
[
text.strip() != i.strip()
for i in all_prompt_text[-check_prompt_num:]
]
):
all_tokens.extend(tokens)
all_prompt_text.append(text)
idx += 1
yield Segment(
id=idx,