- FastAPI server with OpenAI-compatible API - Integration with faster-whisper (large-v3) - Full Docker support with docker-compose - Support for multiple languages (FR/EN/Auto) - Clean, maintainable codebase (~100 lines) - Health endpoint and error handling - Volume caching for models
146 lines
3.6 KiB
Markdown
146 lines
3.6 KiB
Markdown
# 🎙️ Effi-STT
|
|
|
|
> Speech-to-Text API compatible OpenAI pour Effi
|
|
> Solution maison avec faster-whisper
|
|
|
|
## 🎯 Objectif
|
|
|
|
Fournir une API STT (Speech-to-Text) 100% compatible avec l'API OpenAI, fonctionnant parfaitement avec Open WebUI.
|
|
|
|
## ✅ Caractéristiques
|
|
|
|
- **API OpenAI 100% compatible** - Endpoints `/v1/audio/transcriptions` et `/health`
|
|
- **Basé sur faster-whisper** - Rapide et efficace
|
|
- **Support multi-langues** - Français, anglais, et 99+ langues
|
|
- **Dockerisé** - Déploiement simple avec Docker Compose
|
|
- **Extensible** - Code propre et modulaire
|
|
|
|
## 🚀 Installation rapide
|
|
|
|
### Prérequis
|
|
|
|
- Docker et Docker Compose
|
|
- ~3GB d'espace disque (pour le modèle large-v3)
|
|
|
|
### Déploiement
|
|
|
|
```bash
|
|
# Cloner ou copier le dossier effi-stt
|
|
cd effi-stt
|
|
|
|
# Builder et démarrer
|
|
sudo docker compose up -d --build
|
|
|
|
# Attendre le téléchargement du modèle (3-5 min)
|
|
echo "⏳ Téléchargement du modèle..."
|
|
sleep 180
|
|
|
|
# Vérifier les logs
|
|
sudo docker logs effi-stt --tail 20
|
|
|
|
# Tester
|
|
curl http://localhost:8200/health
|
|
curl -X POST http://localhost:8200/v1/audio/transcriptions \
|
|
-F "file=@test.mp3" \
|
|
-F "language=fr"
|
|
```
|
|
|
|
## ⚙️ Configuration
|
|
|
|
### Variables d'environnement
|
|
|
|
| Variable | Défaut | Description |
|
|
|----------|--------|-------------|
|
|
| `MODEL_SIZE` | `large-v3` | Taille du modèle (tiny, base, small, medium, large-v3) |
|
|
| `DEVICE` | `cpu` | Device (cpu, cuda, auto) |
|
|
| `COMPUTE_TYPE` | `int8` | Type de calcul (int8, float16, float32) |
|
|
| `LANGUAGE` | `fr` | Langue par défaut |
|
|
| `CPU_THREADS` | `4` | Nombre de threads CPU |
|
|
| `PORT` | `8200` | Port d'écoute |
|
|
| `HOST` | `0.0.0.0` | Host d'écoute |
|
|
|
|
### Modèles disponibles
|
|
|
|
| Modèle | Taille | Qualité | Vitesse |
|
|
|--------|--------|---------|---------|
|
|
| `tiny` | 39 MB | Basse | Très rapide |
|
|
| `base` | 74 MB | Moyenne | Rapide |
|
|
| `small` | 244 MB | Bonne | Modérée |
|
|
| `medium` | 769 MB | Très bonne | Lente |
|
|
| `large-v3` | 3.1 GB | Excellente | Très lente |
|
|
|
|
## 🔧 Configuration Open WebUI
|
|
|
|
```yaml
|
|
Admin Panel → Settings → Audio
|
|
|
|
STT:
|
|
Engine: OpenAI
|
|
URL: http://192.168.1.11:8200/v1
|
|
Model: whisper-1
|
|
Language: fr
|
|
```
|
|
|
|
## 🧪 Tests
|
|
|
|
```bash
|
|
# Test health
|
|
curl http://localhost:8200/health
|
|
|
|
# Test transcription
|
|
curl -X POST http://localhost:8200/v1/audio/transcriptions \
|
|
-F "file=@audio.mp3" \
|
|
-F "language=fr" \
|
|
-F "response_format=json"
|
|
|
|
# Test avec format texte
|
|
curl -X POST http://localhost:8200/v1/audio/transcriptions \
|
|
-F "file=@audio.mp3" \
|
|
-F "language=fr" \
|
|
-F "response_format=text"
|
|
```
|
|
|
|
## 📁 Structure du projet
|
|
|
|
```
|
|
effi-stt/
|
|
├── main.py # Serveur FastAPI
|
|
├── Dockerfile # Image Docker
|
|
├── docker-compose.yml # Configuration Docker Compose
|
|
├── requirements.txt # Dépendances Python
|
|
└── README.md # Documentation
|
|
```
|
|
|
|
## 🚀 Améliorations futures (TODO)
|
|
|
|
- [ ] Support GPU ROCm pour AMD
|
|
- [ ] Streaming des résultats (transcription en temps réel)
|
|
- [ ] Support du format SRT/VTT avec timestamps
|
|
- [ ] Endpoint de détection de langue
|
|
- [ ] Métriques et monitoring (Prometheus)
|
|
- [ ] Support de la traduction (transcribe + translate)
|
|
|
|
## 📝 Notes
|
|
|
|
- Le modèle est téléchargé automatiquement au premier démarrage
|
|
- Le cache est persisté dans un volume Docker
|
|
- En CPU sur Intel J5040: ~5-10s pour 5s d'audio avec large-v3
|
|
|
|
## 🏗️ Développement
|
|
|
|
```bash
|
|
# Mode développement (hors Docker)
|
|
python -m venv venv
|
|
source venv/bin/activate
|
|
pip install -r requirements.txt
|
|
python main.py
|
|
|
|
# Build Docker manuel
|
|
sudo docker build -t effi-stt:local .
|
|
sudo docker run -p 8200:8200 effi-stt:local
|
|
```
|
|
|
|
---
|
|
|
|
**Créé avec ❤️ pour Effi**
|