File size: 1,687 Bytes
3f14c5d f0e0729 69552e2 ba3cbc7 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | """Environment-derived configuration and global constants.
Importing this module has no side effects beyond reading env vars and computing
a handful of constants. It must not import torch, diffusers, or gradio so it can
be imported anywhere without dragging in heavy dependencies.
"""
import os
import numpy as np
# ββ Model variant selection ββββββββββββββββββββββββββββββββββββββββββββββββββ
MODEL_VARIANT = os.environ.get("MODEL_VARIANT", "9B")
if MODEL_VARIANT == "9B-KV":
_MODEL_REPO = "black-forest-labs/FLUX.2-klein-9b-kv"
else:
MODEL_VARIANT = "9B" # normalise any typos back to default
_MODEL_REPO = "black-forest-labs/FLUX.2-klein-9B"
MODEL_REPO = _MODEL_REPO
# ββ Misc constants βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
MAX_SEED = int(np.iinfo(np.int32).max)
# Maximum number of simultaneous LoRA weight sliders to pre-render in the UI.
MAX_LORA_SLOTS = 6
# External LoRA catalog (bucket-mounted JSON). Single source of truth for the
# selectable list. If missing/empty, the app seeds it from built-in defaults.
PERSISTENT_LORA_CATALOG_PATH = os.environ.get(
"PERSISTENT_LORA_CATALOG_PATH",
"/loras-flux/config/lorasplayground.json",
)
# Abliterated (uncensored) text encoder β replaces the stock Qwen3 text encoder
# weights after pipeline load. Downloaded via HF Hub for speed + caching.
UNCENSORED_TE_REPO = "ponpoke/flux2-klein-9b-uncensored-text-encoder"
UNCENSORED_TE_FILE = "model.safetensors"
|