ssolito commited on
Commit
9b9a3a4
·
verified ·
1 Parent(s): 11d760e

Update whisper.py

Browse files
Files changed (1) hide show
  1. whisper.py +3 -1
whisper.py CHANGED
@@ -127,7 +127,9 @@ def generate(audio_path, use_v2):
127
  left_segs = [(seg["timestamp"][0], seg["timestamp"][1], "Speaker 1", post_process_transcription(seg["text"])) for seg in left_result["chunks"]]
128
  right_segs = [(seg["timestamp"][0], seg["timestamp"][1], "Speaker 2", post_process_transcription(seg["text"])) for seg in right_result["chunks"]]
129
 
130
- merged_transcript = sorted(left_segs + right_segs, key=lambda x: x[0])
 
 
131
 
132
  output = ""
133
  for start, end, speaker, text in merged_transcript:
 
127
  left_segs = [(seg["timestamp"][0], seg["timestamp"][1], "Speaker 1", post_process_transcription(seg["text"])) for seg in left_result["chunks"]]
128
  right_segs = [(seg["timestamp"][0], seg["timestamp"][1], "Speaker 2", post_process_transcription(seg["text"])) for seg in right_result["chunks"]]
129
 
130
+ #merged_transcript = sorted(left_segs + right_segs, key=lambda x: x[0])
131
+ merged_transcript = sorted(left_segs + right_segs, key=lambda x: x[0] if x[0] is not None else 0.0)
132
+
133
 
134
  output = ""
135
  for start, end, speaker, text in merged_transcript: