CLI: --until-enter und optionale LLM-Korrektur (--llm-correct)
- --until-enter: Aufnahme mit beliebig langen Pausen, Enter beendet, Ausgabe als ein Text - stt_llm.py: Nachkorrektur per lokalem LLM (Standard gemma4:12b über Ollama nativ mit kleinem Kontext; OpenAI-kompatible Server möglich), strenger Prompt mit Beispielen, Ähnlichkeitsprüfung und Fehler-Fallback auf den Rohtext - Output-Klasse in der CLI: Korrektur in eigenem Thread, Reihenfolge bleibt erhalten - Tests für die LLM-Korrektur (13 Unit, 1 Integration) - Doku: Bedienungsanleitung, README, Entwicklerdoku (inkl. Modellvergleich), CLAUDE.md Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
340100210d
commit
6ebea4b745
1 changed files with 672 additions and 24 deletions
|
|
@ -13,6 +13,7 @@ Gedacht als Baustein für Sprachassistenten und Smarthome: **Home Assistant** (W
|
|||
- **Äußerungsende per Sprechpause** (Silero-VAD) statt Stoppwort; Text ca. 1 s nach Sprechende.
|
||||
- **Robust:** automatischer CPU-Fallback, beliebige Audioformate, Filter gegen Whisper-Halluzinationen.
|
||||
- **Lokal:** keine Cloud; Internet nur zum einmaligen Herunterladen des Modells.
|
||||
- **Optionale LLM-Korrektur** (`--llm-correct`, lokales `gemma4:12b`) mit Schutz gegen verfälschte Antworten.
|
||||
|
||||
## Dokumentation
|
||||
|
||||
|
|
@ -36,6 +37,7 @@ CUDA_VISIBLE_DEVICES=GPU-<uuid> .venv/bin/python stt_service.py
|
|||
curl http://127.0.0.1:9998/health # "status":"ok" = bereit
|
||||
.venv/bin/python stt_cli.py aufnahme.wav # Datei → Text
|
||||
.venv/bin/python stt_cli.py -v # Mikrofon → Text (Strg+C beendet)
|
||||
.venv/bin/python stt_cli.py --until-enter # Pausen erlaubt, Enter beendet → ein Text
|
||||
```
|
||||
|
||||
Beim ersten Start wird das Modell geladen (`large-v3-turbo` ≈ 1,6 GB). Schnittstellen zum Ausprobieren
|
||||
|
|
@ -66,6 +68,7 @@ curl -F file=@aufnahme.mp3 http://127.0.0.1:9998/v1/audio/transcriptions
|
|||
| `stt_service.py` | FastAPI-Dienst: HTTP, WebSocket, Worker, Start des Wyoming-Servers |
|
||||
| `stt_wyoming.py` | Wyoming-Protokoll für Home Assistant |
|
||||
| `stt_cli.py` | Kommandozeile: Dateien und Mikrofon über den Dienst oder lokal |
|
||||
| `stt_llm.py` | optionale LLM-Nachkorrektur (Ollama oder OpenAI-kompatibel), nur mit `--llm-correct` |
|
||||
| `tests/` | Unit-Tests (ohne Modell) und Integrationstests (echtes Whisper) |
|
||||
| `deploy/stt-service.service` | systemd-User-Unit für den Dauerbetrieb |
|
||||
| `legacy/` | alte Einzelskripte `stt.py`, `stt_respeaker.py` (historisch, nicht gepflegt) |
|
||||
|
|
@ -73,8 +76,8 @@ curl -F file=@aufnahme.mp3 http://127.0.0.1:9998/v1/audio/transcriptions
|
|||
## Tests
|
||||
|
||||
```bash
|
||||
.venv/bin/python -m pytest # 36 Unit-Tests, ohne Modell
|
||||
.venv/bin/python -m pytest -m integration # 4 Integrationstests: Whisper small (CPU) + Silero, espeak-ng-Sprache
|
||||
.venv/bin/python -m pytest # 49 Unit-Tests, ohne Modell
|
||||
.venv/bin/python -m pytest -m integration # 5 Integrationstests: Whisper small (CPU) + Silero, espeak-ng; LLM über Ollama
|
||||
```
|
||||
|
||||
## Bekannte Grenzen
|
||||
|
|
|
|||
Loading…
Reference in a new issue