mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 11:07:40 +01:00
Replace Web Speech API (cloud, silent failures) with MediaRecorder → POST audio blob → Python Whisper (local, no internet) pipeline. Adds real-time waveform visualisation, recording timer, and a clear idle/recording/processing state machine with never-silent error display. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
17 lines
450 B
Python
Executable File
17 lines
450 B
Python
Executable File
#!/usr/bin/env python3
|
|
"""Transcribe audio via local Whisper. Prints text to stdout."""
|
|
import sys, warnings
|
|
warnings.filterwarnings("ignore")
|
|
import whisper
|
|
|
|
def main():
|
|
if len(sys.argv) < 2:
|
|
sys.exit(1)
|
|
model_size = sys.argv[2] if len(sys.argv) > 2 else "base"
|
|
model = whisper.load_model(model_size)
|
|
result = model.transcribe(sys.argv[1], fp16=False)
|
|
print(result["text"].strip())
|
|
|
|
if __name__ == "__main__":
|
|
main()
|