Spaces:
Running
Running
Download docker-compose.yml from kajalan/hf-image-api: direct link, hf CLI and curl.
- Browser
- Download file 2.69 kB
-
https://huggingface.co/spaces/kajalan/hf-image-api/resolve/main/docker-compose.yml
- Command line
-
hf download hf://spaces/kajalan/hf-image-api/docker-compose.yml
-
curl -L -o docker-compose.yml https://huggingface.co/spaces/kajalan/hf-image-api/resolve/main/docker-compose.yml
2.69 kB
| services: | |
| hf-image-api: | |
| build: | |
| context: . | |
| dockerfile: Dockerfile | |
| target: final | |
| image: hf-image-api:latest | |
| container_name: hf-image-api | |
| ports: | |
| - "8000:7860" | |
| # ββ Persistent volumes βββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| volumes: | |
| # Model weights persist between container restarts (avoids re-downloading) | |
| - model_cache:/app/model_cache | |
| # Generated images persist and are accessible on the host | |
| - ./outputs:/app/outputs | |
| # ββ Environment (edit here or in .env) ββββββββββββββββββββββββββββββββββββ | |
| environment: | |
| # Get your free token at https://huggingface.co/settings/tokens | |
| # Enables higher rate limits and faster file resolution from HuggingFace | |
| HF_TOKEN: ${HF_TOKEN:-} | |
| MODEL_ID: ${MODEL_ID:-nota-ai/bk-sdm-small} | |
| AUTO_LOAD_MODEL: ${AUTO_LOAD_MODEL:-true} | |
| CPU_THREADS: ${CPU_THREADS:-0} | |
| ENABLE_ATTENTION_SLICING: ${ENABLE_ATTENTION_SLICING:-true} | |
| DEFAULT_STEPS: ${DEFAULT_STEPS:-20} | |
| MAX_STEPS: ${MAX_STEPS:-50} | |
| DEFAULT_WIDTH: ${DEFAULT_WIDTH:-512} | |
| DEFAULT_HEIGHT: ${DEFAULT_HEIGHT:-512} | |
| MAX_WIDTH: ${MAX_WIDTH:-768} | |
| MAX_HEIGHT: ${MAX_HEIGHT:-768} | |
| DEFAULT_GUIDANCE_SCALE: ${DEFAULT_GUIDANCE_SCALE:-7.5} | |
| OUTPUTS_DIR: /app/outputs | |
| MODEL_CACHE_DIR: /app/model_cache | |
| # ββ CPU resource limits ββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Remove or adjust based on your machine | |
| deploy: | |
| resources: | |
| limits: | |
| cpus: "4.0" # cap at 4 cores (set to your core count) | |
| memory: 8G # 8 GB for bk-sdm-small; use 12 GB for SD v1.5 | |
| reservations: | |
| memory: 2G | |
| restart: unless-stopped | |
| healthcheck: | |
| test: ["CMD", "curl", "-f", "http://localhost:7860/health"] | |
| interval: 30s | |
| timeout: 10s | |
| retries: 3 | |
| start_period: 90s # give extra time for model download on first run | |
| # ββ Named volumes ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| volumes: | |
| model_cache: | |
| driver: local | |