"""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"