TTS

docker run \\
  --rm \\
  --detach \\
  --publish 8000:8000 \\
  --name speaches \\
  --volume hf-hub-cache:/home/ubuntu/.cache/huggingface/hub \\
  ghcr.io/speaches-ai/speaches:latest-cpu
# Verify that the server is running
curl <http://localhost:8000>

Download the Kokoro Model and Voices:

--volume hf-hub-cache:/home/ubuntu/.cache/huggingface/hub creates a bind mount between your local disk and the container. So, although the download process happens within the container, the models are stored on your local disk (thanks to the --volume option) and remain permanent unless you delete the hf-hub-cache directory manually. Even if the container is removed (because of the -rm flag), the models remain on your local disk in the hf-hub-cache directory. When you start a new container with the same -volume configuration, it can access the models without downloading them again.

export KOKORO_REVISION=c97b7bbc3e60f447383c79b2f94fee861ff156ac

# Download the ONNX model (~346 MBs)
docker exec -it speaches huggingface-cli download hexgrad/Kokoro-82M --include 'kokoro-v0_19.onnx' --revision $KOKORO_REVISION

# Download the voices.json (~54 MBs) file

# from docs (but will fail because curl is not installed in the container)
# docker exec -it speaches curl --location --output /home/ubuntu/.cache/huggingface/hub/models--hexgrad--Kokoro-82M/snapshots/$KOKORO_REVISION/voices.json <https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json>

# 1. **Download voices.json Locally**:
curl --location --output voices.json \\
  <https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files/voices.json>

# 2. **Create the Directory Structure**
mkdir -p hf-hub-cache/models--hexgrad--Kokoro-82M/snapshots/$KOKORO_REVISION

# 2. **Move It to the Mounted Volume**:
mv voices.json hf-hub-cache/models--hexgrad--Kokoro-82M/snapshots/$KOKORO_REVISION/

# 3. **Verify Inside the Container**:
docker exec -it speaches ls /home/ubuntu/.cache/huggingface/hub/models--hexgrad--Kokoro-82M/snapshots/$KOKORO_REVISION/

Inside the container, in the correct dir, there must be: model file and voices file. Check with:

docker exec -it speaches ls /home/ubuntu/.cache/huggingface/hub/models--hexgrad--Kokoro-82M/snapshots/c97b7bbc3e60f447383c79b2f94fee861ff156ac/

> kokoro-v0_19.onnx  voices.json

Restart the Container (Optional): If the container is running, it should automatically detect the new file in the mounted volume. If not, you can restart it