- SDXL image generation using RealVisXL_V4.0 - IP-Adapter FaceID integration for consistent face generation - Simplified API (removed client_id requirement) - New params: face_image, face_strength - 'vixy' shortcut for face-locked generation - Queue-based async job processing - FastAPI with proper error handling Co-authored-by: Alex <alex@k4zka.online>
73 lines
2.1 KiB
Python
Executable File
73 lines
2.1 KiB
Python
Executable File
"""
|
|
DreamTail Configuration
|
|
|
|
Configuration for SDXL image generation service running on AGX Orin.
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# Application settings
|
|
APP_NAME = "DreamTail"
|
|
APP_VERSION = "1.0.0"
|
|
API_HOST = "0.0.0.0"
|
|
API_PORT = 8765
|
|
|
|
# Paths
|
|
BASE_DIR = Path(__file__).parent
|
|
STORAGE_DIR = Path(os.getenv("DREAMTAIL_STORAGE", "/app/storage"))
|
|
MODELS_DIR = Path(os.getenv("DREAMTAIL_MODELS", "/app/models"))
|
|
IMAGES_DIR = STORAGE_DIR / "images"
|
|
|
|
# Ensure directories exist
|
|
STORAGE_DIR.mkdir(parents=True, exist_ok=True)
|
|
IMAGES_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
# Model settings
|
|
SDXL_MODEL_ID = "SG161222/RealVisXL_V4.0"
|
|
SDXL_REFINER_ID = "stabilityai/stable-diffusion-xl-refiner-1.0"
|
|
USE_REFINER = False # Set to True to enable refiner (requires more VRAM)
|
|
|
|
# IP-Adapter FaceID settings
|
|
IP_ADAPTER_DIR = Path(os.getenv("DREAMTAIL_IP_ADAPTER", MODELS_DIR / "ip-adapter"))
|
|
IP_ADAPTER_PATH = IP_ADAPTER_DIR / "ip-adapter-faceid_sdxl.bin"
|
|
FACE_REFERENCE_DIR = STORAGE_DIR / "faces" # Directory for face reference images
|
|
DEFAULT_FACE_STRENGTH = 0.6 # How strongly to apply face conditioning (0.0-1.0)
|
|
|
|
# Ensure IP-Adapter directories exist
|
|
IP_ADAPTER_DIR.mkdir(parents=True, exist_ok=True)
|
|
FACE_REFERENCE_DIR.mkdir(parents=True, exist_ok=True)
|
|
|
|
# Generation defaults
|
|
DEFAULT_WIDTH = 1024
|
|
DEFAULT_HEIGHT = 1024
|
|
DEFAULT_STEPS = 30
|
|
DEFAULT_GUIDANCE_SCALE = 7.5
|
|
MIN_STEPS = 10
|
|
MAX_STEPS = 100
|
|
MIN_GUIDANCE = 1.0
|
|
MAX_GUIDANCE = 20.0
|
|
|
|
# Performance settings
|
|
MAX_CONCURRENT_JOBS = 1 # AGX Orin can handle 1 SDXL generation at a time
|
|
ENABLE_ATTENTION_SLICING = True
|
|
ENABLE_VAE_SLICING = True
|
|
ENABLE_CPU_OFFLOAD = False # Only if VRAM is insufficient
|
|
USE_FP16 = True # Half precision for reduced VRAM usage
|
|
|
|
# Queue settings
|
|
MAX_QUEUE_SIZE = 50 # Maximum queued jobs
|
|
JOB_TIMEOUT_SECONDS = 300 # 5 minutes max per job
|
|
|
|
# Storage settings
|
|
IMAGE_RETENTION_DAYS = 10
|
|
CLEANUP_INTERVAL_HOURS = 24
|
|
IMAGE_FORMAT = "PNG"
|
|
IMAGE_QUALITY = 95 # For JPEG (not used for PNG)
|
|
|
|
# Logging
|
|
LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO")
|
|
LOG_FORMAT = "[%(asctime)s] %(levelname)s [%(name)s] %(message)s"
|
|
LOG_DATE_FORMAT = "%H:%M:%S"
|
|
|