Add model auto-download and English logging

This commit is contained in:
Dymas
2026-06-06 12:47:59 +02:00
parent d8b92d5025
commit 0c7f93d067
17 changed files with 204 additions and 77 deletions
+36
View File
@@ -75,9 +75,39 @@ The repository now includes a container setup for running the API in Docker.
- `./models` -> `/models`
Place your Whisper model inside `./models/whisper` or update `model_path` in `config.docker.json`.
That path must contain the actual Hugging Face model files, not just an empty folder.
If you prefer automatic bootstrap, set:
```json
"auto_download_missing_model": true,
"model_repo_id": "openai/whisper-large-v3"
```
With the default Docker config, the container will automatically download that
model into `/models/whisper` on first start if the directory is missing or incomplete.
Expected example layout:
```text
models/
whisper/
config.json
generation_config.json
preprocessor_config.json
tokenizer.json
tokenizer_config.json
model.safetensors
```
### Build and run with Docker Compose
If your selected model requires authentication on Hugging Face, export a token first:
```bash
export HF_TOKEN=your_huggingface_token
```
```bash
docker compose up --build
```
@@ -93,6 +123,7 @@ http://localhost:5042
```bash
docker build -t whisper-api-server .
docker run --rm -p 5042:5042 \
-e HF_TOKEN="$HF_TOKEN" \
-v "$(pwd)/config.docker.json:/app/config.docker.json:ro" \
-v "$(pwd)/logs:/app/logs" \
-v "$(pwd)/history:/app/history" \
@@ -106,6 +137,7 @@ The container image installs the same Python dependencies as the local setup, in
```bash
docker run --rm --gpus all -p 5042:5042 \
-e HF_TOKEN="$HF_TOKEN" \
-v "$(pwd)/config.docker.json:/app/config.docker.json:ro" \
-v "$(pwd)/logs:/app/logs" \
-v "$(pwd)/history:/app/history" \
@@ -121,6 +153,8 @@ The service is configured through the `config.json` file:
{
"service_port": 5042,
"model_path": "/path/to/whisper/model",
"auto_download_missing_model": false,
"model_repo_id": "openai/whisper-large-v3",
"language": "russian",
"enable_history": true,
"max_history_days": 30,
@@ -152,6 +186,8 @@ The service is configured through the `config.json` file:
|-----------|-------------|
| `service_port` | Port on which the service will run |
| `model_path` | Path to the Whisper model directory |
| `auto_download_missing_model` | Download the configured fallback model into `model_path` when the local directory is missing or incomplete |
| `model_repo_id` | Hugging Face model repo to download when auto-download is enabled |
| `language` | Language for transcription (e.g., "russian", "english") |
| `enable_history` | Whether to save transcription history (true/false) |
| `max_history_days` | Number of days to keep transcription history before rotation |