ai-image-generator / config.py
Robin7339's picture
Update config.py
fe516f0 verified
"""
Configuration settings for AI Image Generator
OPTIMIZED FOR CPU DEPLOYMENT
"""
# Model Configuration
MODEL_ID = "stabilityai/stable-diffusion-xl-base-1.0"
REFINER_ID = "stabilityai/stable-diffusion-xl-refiner-1.0"
USE_REFINER = False # Disabled for CPU performance
# Generation Defaults - OPTIMIZED FOR CPU
DEFAULT_WIDTH = 768 # Reduced from 1024 for faster CPU generation
DEFAULT_HEIGHT = 768
DEFAULT_GUIDANCE_SCALE = 7.5
DEFAULT_NUM_STEPS = 25 # Reduced from 30 for faster CPU generation
DEFAULT_REFINER_STEPS = 20
# Quality Validation
MIN_QUALITY_SCORE = 0.25 # Minimum CLIP score to accept
MAX_RETRIES = 1 # Reduced to 1 for CPU (less waiting time)
# Style Presets
STYLE_PRESETS = {
"None": {
"prompt_suffix": "",
"negative_prompt": "blurry, distorted, deformed, low quality, watermark"
},
"Photorealistic": {
"prompt_suffix": "photorealistic, 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3",
"negative_prompt": "painting, drawing, illustration, cartoon, anime, blurry, distorted, deformed, low quality, watermark, text, logo, signature"
},
"Digital Art": {
"prompt_suffix": "concept art, digital painting, artstation, highly detailed, vibrant colors, dramatic lighting, trending on artstation",
"negative_prompt": "photorealistic, photograph, blurry, low quality, watermark, text, logo, signature, deformed"
},
"Anime": {
"prompt_suffix": "anime style, highly detailed, vibrant colors, studio anime, key visual, sharp focus, professional",
"negative_prompt": "photorealistic, 3d render, blurry, low quality, watermark, text, western cartoon, deformed, bad anatomy"
},
"Cinematic": {
"prompt_suffix": "cinematic lighting, dramatic atmosphere, film grain, epic composition, movie still, professional cinematography, 35mm film",
"negative_prompt": "amateur, snapshot, blurry, low quality, watermark, text, logo, oversaturated"
},
"Oil Painting": {
"prompt_suffix": "oil painting, classical art style, painterly, brushstrokes, fine art, museum quality, masterpiece",
"negative_prompt": "photograph, digital art, 3d render, blurry, low quality, watermark, text, modern"
},
"3D Render": {
"prompt_suffix": "3d render, octane render, ray tracing, unreal engine 5, highly detailed, professional 3d, volumetric lighting",
"negative_prompt": "2d, flat, painting, sketch, blurry, low quality, watermark, text, logo, deformed"
},
"Portrait": {
"prompt_suffix": "portrait photography, professional lighting, sharp focus, detailed face, professional headshot, 85mm lens, bokeh",
"negative_prompt": "full body, landscape, blurry, low quality, watermark, text, bad anatomy, extra fingers, deformed face"
}
}
# Aspect Ratios - OPTIMIZED FOR CPU (smaller sizes)
ASPECT_RATIOS = {
"Square (1:1)": (768, 768), # Reduced from 1024
"Portrait (3:4)": (640, 832), # Reduced proportionally
"Landscape (4:3)": (832, 640), # Reduced proportionally
"Wide (16:9)": (896, 512), # Reduced proportionally
"Ultrawide (21:9)": (1024, 448) # Reduced proportionally
}
# Negative Prompt Base
BASE_NEGATIVE_PROMPT = "blurry, distorted, deformed, disfigured, low quality, watermark, text, logo, signature, username, bad anatomy, extra limbs, extra fingers, missing limbs, cropped, worst quality, low resolution"