MCPcopy
hub / github.com/mli/autocut / run

Method run

autocut/transcribe.py:39–54  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

37 logging.info(f"Done Init model in {time.time() - tic:.1f} sec")
38
39 def run(self):
40 for input in self.args.inputs:
41 logging.info(f"Transcribing {input}")
42 name, _ = os.path.splitext(input)
43 if utils.check_exists(name + ".md", self.args.force):
44 continue
45
46 audio = utils.load_audio(input, sr=self.sampling_rate)
47 speech_array_indices = self._detect_voice_activity(audio)
48 transcribe_results = self._transcribe(input, audio, speech_array_indices)
49
50 output = name + ".srt"
51 self._save_srt(output, transcribe_results)
52 logging.info(f"Transcribed {input} to {output}")
53 self._save_md(name + ".md", output, input)
54 logging.info(f'Saved texts to {name + ".md"} to mark sentences')
55
56 def _detect_voice_activity(self, audio) -> List[SPEECH_ARRAY_INDEX]:
57 """Detect segments that have voice activities"""

Callers 6

test_en_transcribeMethod · 0.95
test_force_transcribeMethod · 0.95
test_vad_transcribeMethod · 0.95

Calls 4

_transcribeMethod · 0.95
_save_srtMethod · 0.95
_save_mdMethod · 0.95

Tested by 6

test_en_transcribeMethod · 0.76
test_force_transcribeMethod · 0.76
test_vad_transcribeMethod · 0.76