mirror of
https://github.com/remsky/Kokoro-FastAPI.git
synced 2025-04-13 09:39:17 +00:00
80 lines
2.3 KiB
YAML
80 lines
2.3 KiB
YAML
name: kokoro-fastapi
|
|
services:
|
|
model-fetcher:
|
|
image: datamachines/git-lfs:latest
|
|
environment:
|
|
- SKIP_MODEL_FETCH=${SKIP_MODEL_FETCH:-false}
|
|
volumes:
|
|
- ./Kokoro-82M:/app/Kokoro-82M
|
|
working_dir: /app/Kokoro-82M
|
|
command: >
|
|
sh -c "
|
|
if [ \"$$SKIP_MODEL_FETCH\" = \"true\" ]; then
|
|
echo 'Skipping model fetch...' && touch .cloned;
|
|
else
|
|
rm -f .git/index.lock;
|
|
if [ -z \"$(ls -A .)\" ]; then
|
|
git clone https://huggingface.co/hexgrad/Kokoro-82M .
|
|
touch .cloned;
|
|
else
|
|
rm -f .git/index.lock && \
|
|
git checkout main && \
|
|
git pull origin main && \
|
|
touch .cloned;
|
|
fi;
|
|
fi;
|
|
tail -f /dev/null
|
|
"
|
|
healthcheck:
|
|
test: ["CMD", "test", "-f", ".cloned"]
|
|
interval: 5s
|
|
timeout: 2s
|
|
retries: 300
|
|
start_period: 1s
|
|
|
|
kokoro-tts:
|
|
image: ghcr.io/remsky/kokoro-fastapi-gpu:v0.0.5post1
|
|
# Uncomment below (and comment out above) to build from source instead of using the released image
|
|
# build:
|
|
# context: .
|
|
volumes:
|
|
- ./api/src:/app/api/src
|
|
- ./Kokoro-82M:/app/Kokoro-82M
|
|
ports:
|
|
- "8880:8880"
|
|
environment:
|
|
- PYTHONPATH=/app:/app/Kokoro-82M
|
|
deploy:
|
|
resources:
|
|
reservations:
|
|
devices:
|
|
- driver: nvidia
|
|
count: 1
|
|
capabilities: [gpu]
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8880/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 30
|
|
start_period: 30s
|
|
depends_on:
|
|
model-fetcher:
|
|
condition: service_healthy
|
|
|
|
# Gradio UI service [Comment out everything below if you don't need it]
|
|
gradio-ui:
|
|
image: ghcr.io/remsky/kokoro-fastapi-ui:v0.0.5post1
|
|
# Uncomment below (and comment out above) to build from source instead of using the released image
|
|
# build:
|
|
# context: ./ui
|
|
ports:
|
|
- "7860:7860"
|
|
volumes:
|
|
- ./ui/data:/app/ui/data
|
|
- ./ui/app.py:/app/app.py # Mount app.py for hot reload
|
|
environment:
|
|
- GRADIO_WATCH=True # Enable hot reloading
|
|
- PYTHONUNBUFFERED=1 # Ensure Python output is not buffered
|
|
depends_on:
|
|
kokoro-tts:
|
|
condition: service_healthy
|