Skip to content

Commit

Permalink
Fixes #223 : update code to work with auditok>0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeronymous committed Nov 25, 2024
1 parent 9b12d9f commit d3a5e1a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions whisper_timestamped/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
__author__ = "Jérôme Louradour"
__credits__ = ["Jérôme Louradour"]
__license__ = "GPLv3"
__version__ = "1.15.6"
__version__ = "1.15.7"

# Set some environment variables
import os
Expand Down Expand Up @@ -2044,7 +2044,14 @@ def apply_folder_hack():
drop_trailing_silence=True,
)

segments = [{"start": s._meta.start * sample_rate, "end": s._meta.end * sample_rate} for s in segments]
if auditok.__version__ >= "0.3.0":
def auditok_segment_to_dict(s):
return {"start": s.start * sample_rate, "end": s.end * sample_rate}
else:
def auditok_segment_to_dict(s):
return {"start": s._meta.start * sample_rate, "end": s._meta.end * sample_rate}

segments = [auditok_segment_to_dict(s) for s in segments]

else:
raise ValueError(f"Got unexpected VAD method {method}")
Expand Down

0 comments on commit d3a5e1a

Please sign in to comment.