Skip to content

Commit d3a5e1a

Browse files
committed
Fixes #223 : update code to work with auditok>0.2.0
1 parent 9b12d9f commit d3a5e1a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

whisper_timestamped/transcribe.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
__author__ = "Jérôme Louradour"
44
__credits__ = ["Jérôme Louradour"]
55
__license__ = "GPLv3"
6-
__version__ = "1.15.6"
6+
__version__ = "1.15.7"
77

88
# Set some environment variables
99
import os
@@ -2044,7 +2044,14 @@ def apply_folder_hack():
20442044
drop_trailing_silence=True,
20452045
)
20462046

2047-
segments = [{"start": s._meta.start * sample_rate, "end": s._meta.end * sample_rate} for s in segments]
2047+
if auditok.__version__ >= "0.3.0":
2048+
def auditok_segment_to_dict(s):
2049+
return {"start": s.start * sample_rate, "end": s.end * sample_rate}
2050+
else:
2051+
def auditok_segment_to_dict(s):
2052+
return {"start": s._meta.start * sample_rate, "end": s._meta.end * sample_rate}
2053+
2054+
segments = [auditok_segment_to_dict(s) for s in segments]
20482055

20492056
else:
20502057
raise ValueError(f"Got unexpected VAD method {method}")

0 commit comments

Comments
 (0)