transcribe: fix empty segments
Sometimes the whisper model generates segments with no words in them. Skip these segments.
This commit is contained in:
@@ -10,6 +10,8 @@ def transcribe(input_file, dev):
|
||||
segments = []
|
||||
for seg in result["segments"]:
|
||||
words = seg["words"]
|
||||
if not words:
|
||||
continue
|
||||
start = words[0]["start"]
|
||||
end = words[-1]["end"]
|
||||
segments.append(Segment(start, end, seg["text"].strip()))
|
||||
|
||||
Reference in New Issue
Block a user