Add clip_timestamps and hallucination_silence_threshold options (#646)

This commit is contained in:
trungkienbkhn
2024-02-20 23:34:54 +07:00
committed by GitHub
parent 6ffcbdfbc2
commit 092067208b
2 changed files with 157 additions and 19 deletions

View File

@@ -146,3 +146,10 @@ class disabled_tqdm(tqdm):
def __init__(self, *args, **kwargs):
kwargs["disable"] = True
super().__init__(*args, **kwargs)
def get_end(segments: List[dict]) -> Optional[float]:
return next(
(w["end"] for s in reversed(segments) for w in reversed(s["words"])),
segments[-1]["end"] if segments else None,
)