Skip to content

Commit

Permalink
🐛 Fix crash in speaker identification if segment starts less than 0.1…
Browse files Browse the repository at this point in the history
…s before audio end
  • Loading branch information
pajowu committed Nov 18, 2023
1 parent 436512c commit 3e5154b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion worker/transcribee_worker/identify_speakers.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ def time_to_sample(time: float | None):

segments = [
(
time_to_sample(child.children[0].start),
min(
time_to_sample(child.children[0].start),
# we always use at least 0.1s,
# otherwise the fingerprinting model explodes sometimes
# since the start of the segment might be less than 0.1s
# from end of the audio, we use this as a safety
len(audio) - time_to_sample(0.1),
),
max(
time_to_sample(child.children[-1].end),
# we always use at least 0.1s,
Expand Down

0 comments on commit 3e5154b

Please sign in to comment.