# ── HF CPU Image Generation API — environment configuration ────────────────── # Copy this file to .env and edit as needed. # All values shown here are the defaults. # ── Server ──────────────────────────────────────────────────────────────────── HOST=0.0.0.0 PORT=8000 DEBUG=false # ── Hugging Face ────────────────────────────────────────────────────────────── # Get your free token at https://huggingface.co/settings/tokens # Removes the rate-limit warning and speeds up model file resolution HF_TOKEN= # ── Model ───────────────────────────────────────────────────────────────────── # Recommended CPU models (smallest to largest): # # nota-ai/bk-sdm-small ~500 MB — fastest on CPU (default) # runwayml/stable-diffusion-v1-5 ~4 GB — best quality/compat balance # stabilityai/stable-diffusion-2-1-base ~5 GB — highest quality # MODEL_ID=nota-ai/bk-sdm-small MODEL_CACHE_DIR=./model_cache # Load the model at startup so the first job doesn't pay cold-start cost. # Set to false if you want to control loading manually via POST /models/load AUTO_LOAD_MODEL=true # ── CPU Tuning ───────────────────────────────────────────────────────────────── # 0 = use all logical CPU cores (recommended) CPU_THREADS=0 # Slice attention into smaller chunks — lowers peak RAM, minimal speed cost ENABLE_ATTENTION_SLICING=true # ── Generation defaults ──────────────────────────────────────────────────────── # DPM++ scheduler converges well at 20 steps — good CPU/quality balance DEFAULT_STEPS=20 MAX_STEPS=50 # 512×512 is ideal for SD v1.x — larger sizes increase RAM and time significantly DEFAULT_WIDTH=512 DEFAULT_HEIGHT=512 MAX_WIDTH=768 MAX_HEIGHT=768 DEFAULT_GUIDANCE_SCALE=7.5 # ── Storage ──────────────────────────────────────────────────────────────────── OUTPUTS_DIR=./outputs # Auto-delete jobs after N seconds (0 = keep forever) JOB_TTL_SECONDS=0