Metadata-Version: 2.4
Name: vntts
Version: 0.1.4
Summary: Vietnamese Text-to-Speech and Speech-to-Text library with embedded models
Author-email: Devhub Solutions <dnt.doanngocthanh@devhub.ai.vn>
Maintainer-email: Devhub Solutions <dnt.doanngocthanh@devhub.ai.vn>
License: MIT
Project-URL: Homepage, https://github.com/Devhub-Solutions/VNTTS
Project-URL: Repository, https://github.com/Devhub-Solutions/VNTTS
Project-URL: Issues, https://github.com/Devhub-Solutions/VNTTS/issues
Keywords: tts,stt,text-to-speech,speech-to-text,vietnamese,onnx,piper,sherpa
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: sherpa-onnx>=1.12.38
Requires-Dist: piper-tts>=1.4.2
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Dynamic: license-file

# VNTTS

Dự án tích hợp **Vietnamese Text-to-Speech (TTS)** và **Speech-to-Text (STT)**:

- **TTS**: [`nghitts`](https://github.com/nghimestudio/nghitts) / Piper-compatible ONNX (giọng Banmai)
- **STT**: [`sherpa-onnx-zipformer-vi-2025-04-20`](https://huggingface.co/csukuangfj/sherpa-onnx-zipformer-vi-2025-04-20)

## Cấu trúc dự án

```text
VNTTS/
  src/vntts/
    __init__.py
    tts.py
    stt.py
    model_downloader.py   # Downloads models from GitHub Releases
    model_parts.py        # Helpers for split/merge model files
  scripts/
    split_model.py
    merge_model.py
  tests/
  README.md
```

## Cài đặt

```bash
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
```

## Model Loading

Models are **automatically downloaded** from GitHub Releases on first use.
When `TTS()` or `STT()` is instantiated without an explicit `model_dir`,
the library:

1. Checks if the models directory exists (default: `./models`)
2. If not, downloads `models.zip` from the configured GitHub Release URL
3. Extracts the zip and removes the archive
4. Subsequent runs skip the download (idempotent)

### Environment Variables

| Variable | Description | Default |
|---|---|---|
| `VNTTS_MODELS_DIR` | Root directory for models | `models` |
| `VNTTS_MODELS_URL` | URL for `models.zip` | *(GitHub Release)* |
| `VNTTS_MODEL_DOWNLOAD_TIMEOUT_SECONDS` | Network timeout | `120` |
| `VNTTS_MODEL_DOWNLOAD_RETRIES` | Retry attempts | `3` |
| `VNTTS_MODEL_DOWNLOAD_LOG` | Set `0` to disable logs | `1` |

### Explicit Model Directory

You can also provide your own model directory:

```python
from vntts import TTS, STT

tts = TTS(model_dir="/path/to/tts/models")
stt = STT(model_dir="/path/to/stt/models")
```

## Testing

```bash
pytest
```

## Building

```bash
python -m build
```
