Dockerized FastAPI wrapper for Kokoro-82M text-to-speech model w/CPU ONNX and NVIDIA GPU PyTorch support, handling, and auto-stitching
Find a file
remsky ce0ef3534a Add initial implementation of Kokoro TTS API with Docker GPU support
- Set up FastAPI application with TTS service
- Define API endpoints for TTS generation and voice listing
- Implement Pydantic models for request and response schemas
- Add Dockerfile and docker-compose.yml for containerization
- Include example usage and benchmark results in README
2024-12-30 04:17:50 -07:00
api/src Add initial implementation of Kokoro TTS API with Docker GPU support 2024-12-30 04:17:50 -07:00
examples Add initial implementation of Kokoro TTS API with Docker GPU support 2024-12-30 04:17:50 -07:00
.gitignore Add initial implementation of Kokoro TTS API with Docker GPU support 2024-12-30 04:17:50 -07:00
docker-compose.yml Add initial implementation of Kokoro TTS API with Docker GPU support 2024-12-30 04:17:50 -07:00
Dockerfile Add initial implementation of Kokoro TTS API with Docker GPU support 2024-12-30 04:17:50 -07:00
README.md Add initial implementation of Kokoro TTS API with Docker GPU support 2024-12-30 04:17:50 -07:00

Kokoro TTS API

FastAPI wrapper for Kokoro TTS with voice cloning. Runs inference on GPU.

Quick Start

# Start the API (will automatically download model on first run)
docker compose up --build
# From host terminal, test it out with some API calls
python examples/test_tts.py "Hello world" --voice af_bella

API Endpoints

GET /tts/voices           # List voices
POST /tts                 # Generate speech
GET /tts/{request_id}     # Check status
GET /tts/file/{request_id} # Get audio file

Example Usage

List voices:

python examples/test_tts.py

Generate speech:

# Default voice
python examples/test_tts.py "Your text here"

# Specific voice
python examples/test_tts.py --voice af_bella "Your text here"

# Just get file path (no download)
python examples/test_tts.py --no-download "Your text here"

Generated files in examples/output/ (or in src/output/ of API if --no-download)

Requirements

  • Docker
  • NVIDIA GPU + CUDA
  • nvidia-container-toolkit