summaryrefslogtreecommitdiffstats
path: root/roles/caption/templates
diff options
context:
space:
mode:
authorSacha Chua <sacha@sachachua.com>2022-10-29 08:29:16 -0400
committerSacha Chua <sacha@sachachua.com>2022-10-29 08:29:16 -0400
commit04a095491541cd47355e17e3636bff8fe86490cd (patch)
tree1d165961d77be721aa41a2fbfdbe863d5518dd0d /roles/caption/templates
parenta6a373410bde6918f27992ff967660c0541f810a (diff)
downloademacsconf-ansible-04a095491541cd47355e17e3636bff8fe86490cd.tar.xz
emacsconf-ansible-04a095491541cd47355e17e3636bff8fe86490cd.zip
Unbreak my script
Diffstat (limited to '')
-rwxr-xr-xroles/caption/templates/process-captions.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/roles/caption/templates/process-captions.py b/roles/caption/templates/process-captions.py
index 66f39dd..f3f317d 100755
--- a/roles/caption/templates/process-captions.py
+++ b/roles/caption/templates/process-captions.py
@@ -32,7 +32,10 @@ import datetime
import sys
import webvtt
import xml.etree.ElementTree as ET
-from lhotse import RecordinRecording, AudioSource, SupervisionSegment, SupervisionSet, create_cut_set_e
+from lhotse import RecordingSet, Recording, AudioSource, SupervisionSegment, SupervisionSet, create_cut_set_eager, align_with_torchaudio, CutSet, annotate_with_whisper
+import whisper
+import re
+import os
import json
import torch
@@ -153,7 +156,7 @@ def generate_srv2(work):
captions.append(SupervisionSegment(id=rec_id + '-sup' + '%05d' % i, channel=recs[0].channel_ids[0], recording_id=rec_id, start=to_sec(caption.start), duration=to_sec(caption.end) - to_sec(caption.start), text=caption.text, language='English'))
sups = SupervisionSet.from_segments(captions)
main = CutSet.from_manifests(recordings=recs, supervisions=sups)
- work['cuts'] = main.trim_to_supervisions(keep_all_channels=True)
+ work['cuts'] = main.trim_to_supervisions(keep_overlapping=False, keep_all_channels=True)
cuts_aligned = align_with_torchaudio(work['cuts'])
root = ET.Element("timedtext")
doc = ET.SubElement(root, "window")