diff options
| author | vin <git@vineetk.net> | 2025-08-22 23:28:51 -0400 |
|---|---|---|
| committer | vin <git@vineetk.net> | 2025-08-22 23:28:51 -0400 |
| commit | 3b4865a270888643446d9092ba55d69b79117e5e (patch) | |
| tree | e2868a6f7e561dd2e87ba20b59d352d67ca09746 | |
| parent | a08bed429831b989b57b732ce04bf7158abc2cc1 (diff) | |
whisper.cpp replaced by onnx-asr
| -rw-r--r-- | transcript.py | 42 |
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 @@ | |||
| 1 | import os | ||
| 2 | import subprocess | ||
| 3 | import sys | ||
| 4 | from tqdm import tqdm | ||
| 5 | |||
| 6 | # hardcoded because lazy | ||
| 7 | WHISPER_DIR = "/data/src/clones/llm/whisper.cpp" | ||
| 8 | WHISPER_MODEL = "ggml-large-v3-turbo-q5_0" | ||
| 9 | #WHISPER_MODEL = "ggml-distil-large-v3.5" | ||
| 10 | |||
| 11 | def 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 | |||
| 30 | def 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 | |||
| 41 | if __name__ == '__main__': | ||
| 42 | main() | ||
