19 lines
592 B
Python
Executable File
19 lines
592 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Whisper transcription wrapper for OpenClaw voice notes.
|
|
Outputs transcript text to stdout."""
|
|
|
|
import sys
|
|
|
|
def transcribe(path):
|
|
from faster_whisper import WhisperModel
|
|
model = WhisperModel("base.en", device="cpu", compute_type="int8")
|
|
segments, _ = model.transcribe(path, beam_size=5, language="en")
|
|
text = " ".join(seg.text for seg in segments).strip()
|
|
print(text)
|
|
|
|
if __name__ == "__main__":
|
|
if len(sys.argv) < 2:
|
|
print("Usage: whisper-transcribe.py <audio-file>", file=sys.stderr)
|
|
sys.exit(1)
|
|
transcribe(sys.argv[-1])
|