Spaces:
Sleeping

hf-image-api / .env.example
kajalan's picture
Upload 17 files (#8)
576a898
Raw History Blame Contribute Delete
2.74 kB
# ── 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