summaryrefslogtreecommitdiff
path: root/transcript.py
diff options
context:
space:
mode:
Diffstat (limited to 'transcript.py')
-rw-r--r--transcript.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/transcript.py b/transcript.py
deleted file mode 100644
index e4a63dc..0000000
--- a/transcript.py
+++ /dev/null
@@ -1,42 +0,0 @@
1import os
2import subprocess
3import sys
4from tqdm import tqdm
5
6# hardcoded because lazy
7WHISPER_DIR = "/data/src/clones/llm/whisper.cpp"
8WHISPER_MODEL = "ggml-large-v3-turbo-q5_0"
9#WHISPER_MODEL = "ggml-distil-large-v3.5"
10
11def transcribe_file(input_file):
12 base, _ = os.path.splitext(input_file)
13 output_file = base + '.txt'
14
15 if os.path.exists(output_file):
16 return
17
18 whisper_cli = f"{WHISPER_DIR}/build/bin/whisper-cli"
19 model_path = f"{WHISPER_DIR}/models/{WHISPER_MODEL}.bin"
20
21 cmd = [whisper_cli, '-m', model_path, input_file]
22
23 result = subprocess.run(cmd, capture_output=True, text=True)
24 if result.returncode != 0:
25 print(f"Error transcribing {input_file}: {result.stderr}")
26 return
27 with open(output_file, 'w', encoding='utf-8') as f:
28 f.write(result.stdout)
29
30def main():
31 inputs = sys.argv[1:]
32 if not inputs:
33 print("No input files given")
34 return
35
36 with tqdm(inputs) as pbar:
37 for file in pbar:
38 pbar.set_description(f"Transcribing {os.path.basename(file)}")
39 transcribe_file(file)
40
41if __name__ == '__main__':
42 main()