Refactor tool-speechtotext: extract sttlib shared library and add tests
Extract duplicated code (Whisper loading, audio recording, transcription, VAD processing) into reusable sttlib/ package. Rewrite all 3 scripts as thin wrappers. Add 24 unit tests with mocked hardware. Fix GPU fallback bug in assistant.py and args.system assignment bug.
This commit is contained in:
7
python/tool-speechtotext/sttlib/__init__.py
Normal file
7
python/tool-speechtotext/sttlib/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from sttlib.whisper_loader import load_whisper_model
|
||||
from sttlib.audio import record_until_enter, pcm_bytes_to_float32
|
||||
from sttlib.transcription import transcribe, is_hallucination, HALLUCINATION_PATTERNS
|
||||
from sttlib.vad import (
|
||||
VADProcessor, audio_callback, audio_queue,
|
||||
SAMPLE_RATE, CHANNELS, FRAME_DURATION_MS, FRAME_SIZE, MIN_UTTERANCE_FRAMES,
|
||||
)
|
||||
Reference in New Issue
Block a user