A small helpdesk system: an office Pixel running a patched GrapheneOS Dialer answers technician calls, records both call legs as separate channels, and a Ruby backend transcribes them through Whisper and files an AI summary against the caller. Squashed to a single commit for sharing. No credentials are included; secrets live outside the repo in /etc/helpdesk/env on the server or a gitignored .claude/env.local locally. See .claude/env.local.example for the shape. Start at README.md, then docs/architecture.md.
69 lines
2.2 KiB
Markdown
69 lines
2.2 KiB
Markdown
# transcribe.py - Czech audio → text with speaker tags
|
||
|
||
Offline Czech speech-to-text. Output is plain `[Speaker N]: …` turns.
|
||
Built on WhisperX (Whisper large-v2 + Czech wav2vec2 alignment + pyannote
|
||
speaker-diarization-community-1). 100% local - no cloud calls.
|
||
|
||
## One-time setup (~5 min + ~5 GB model download on first run)
|
||
|
||
```bash
|
||
sudo apt install ffmpeg # Debian/Ubuntu; use your distro's pkg mgr otherwise
|
||
cd whisper
|
||
python3 -m venv .venv
|
||
source .venv/bin/activate
|
||
pip install -r requirements.txt
|
||
```
|
||
|
||
The Hugging Face token in `.env` is mine and the gated-repo terms are
|
||
already accepted on that account, so it just works. **No HF account or
|
||
clicks needed on your side.** If you'd rather use your own token, replace
|
||
`HF_TOKEN` in `.env`, then visit (logged in) and click "Agree" on:
|
||
|
||
- https://huggingface.co/pyannote/speaker-diarization-community-1
|
||
- https://huggingface.co/pyannote/segmentation-3.0
|
||
|
||
## Run
|
||
|
||
```bash
|
||
set -a; source .env; set +a # load HF_TOKEN
|
||
source .venv/bin/activate # if not already active
|
||
python transcribe.py recording.m4a # → recording.txt
|
||
```
|
||
|
||
Common flags:
|
||
|
||
```
|
||
--timestamps prepend [HH:MM:SS] to each turn
|
||
--min-speakers 2 lower bound (default 2)
|
||
--max-speakers 3 upper bound (default 3)
|
||
--model large-v3 alternative model (default: large-v2)
|
||
--language en non-Czech audio
|
||
-o out.txt custom output path
|
||
```
|
||
|
||
Accepts any format ffmpeg can read: mp3, wav, m4a, ogg, flac, mp4, …
|
||
|
||
## Speed
|
||
|
||
- NVIDIA GPU: ~realtime (10 min audio → ~10 min processing)
|
||
- CPU only: 5-20× slower (10 min audio → 1-3 hours). The tool warns and
|
||
proceeds automatically.
|
||
|
||
## Live progress bar (optional)
|
||
|
||
In a second terminal while a run is going:
|
||
|
||
```bash
|
||
bash watch_progress.sh
|
||
```
|
||
|
||
## Smoke test (optional)
|
||
|
||
`bash smoke_test.sh` - needs `espeak-ng` (`sudo apt install espeak-ng`).
|
||
Synthesizes a fake 2-speaker Czech dialogue and runs the full pipeline.
|
||
TTS audio so the transcription is robotic gibberish; only verifies plumbing.
|
||
|
||
## Exit codes
|
||
|
||
`0` ok · `2` bad args / missing token · `3` no ffmpeg · `5` HF terms not
|
||
accepted · `6` alignment model failed · `7` diarization failed · `130` Ctrl-C
|