Spaces:
Sleeping
Sleeping
Update config.py
Browse files
config.py
CHANGED
|
@@ -1,67 +1,68 @@
|
|
| 1 |
-
"""
|
| 2 |
-
Configuration settings for AI Image Generator
|
| 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 |
-
"
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
"
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
"
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
"
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
"
|
| 54 |
-
|
| 55 |
-
}
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
"
|
| 61 |
-
"
|
| 62 |
-
"
|
| 63 |
-
"
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Configuration settings for AI Image Generator
|
| 3 |
+
OPTIMIZED FOR CPU DEPLOYMENT
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
# Model Configuration
|
| 7 |
+
MODEL_ID = "stabilityai/stable-diffusion-xl-base-1.0"
|
| 8 |
+
REFINER_ID = "stabilityai/stable-diffusion-xl-refiner-1.0"
|
| 9 |
+
USE_REFINER = False # Disabled for CPU performance
|
| 10 |
+
|
| 11 |
+
# Generation Defaults - OPTIMIZED FOR CPU
|
| 12 |
+
DEFAULT_WIDTH = 768 # Reduced from 1024 for faster CPU generation
|
| 13 |
+
DEFAULT_HEIGHT = 768
|
| 14 |
+
DEFAULT_GUIDANCE_SCALE = 7.5
|
| 15 |
+
DEFAULT_NUM_STEPS = 25 # Reduced from 30 for faster CPU generation
|
| 16 |
+
DEFAULT_REFINER_STEPS = 20
|
| 17 |
+
|
| 18 |
+
# Quality Validation
|
| 19 |
+
MIN_QUALITY_SCORE = 0.25 # Minimum CLIP score to accept
|
| 20 |
+
MAX_RETRIES = 1 # Reduced to 1 for CPU (less waiting time)
|
| 21 |
+
|
| 22 |
+
# Style Presets
|
| 23 |
+
STYLE_PRESETS = {
|
| 24 |
+
"None": {
|
| 25 |
+
"prompt_suffix": "",
|
| 26 |
+
"negative_prompt": "blurry, distorted, deformed, low quality, watermark"
|
| 27 |
+
},
|
| 28 |
+
"Photorealistic": {
|
| 29 |
+
"prompt_suffix": "photorealistic, 8k uhd, dslr, soft lighting, high quality, film grain, Fujifilm XT3",
|
| 30 |
+
"negative_prompt": "painting, drawing, illustration, cartoon, anime, blurry, distorted, deformed, low quality, watermark, text, logo, signature"
|
| 31 |
+
},
|
| 32 |
+
"Digital Art": {
|
| 33 |
+
"prompt_suffix": "concept art, digital painting, artstation, highly detailed, vibrant colors, dramatic lighting, trending on artstation",
|
| 34 |
+
"negative_prompt": "photorealistic, photograph, blurry, low quality, watermark, text, logo, signature, deformed"
|
| 35 |
+
},
|
| 36 |
+
"Anime": {
|
| 37 |
+
"prompt_suffix": "anime style, highly detailed, vibrant colors, studio anime, key visual, sharp focus, professional",
|
| 38 |
+
"negative_prompt": "photorealistic, 3d render, blurry, low quality, watermark, text, western cartoon, deformed, bad anatomy"
|
| 39 |
+
},
|
| 40 |
+
"Cinematic": {
|
| 41 |
+
"prompt_suffix": "cinematic lighting, dramatic atmosphere, film grain, epic composition, movie still, professional cinematography, 35mm film",
|
| 42 |
+
"negative_prompt": "amateur, snapshot, blurry, low quality, watermark, text, logo, oversaturated"
|
| 43 |
+
},
|
| 44 |
+
"Oil Painting": {
|
| 45 |
+
"prompt_suffix": "oil painting, classical art style, painterly, brushstrokes, fine art, museum quality, masterpiece",
|
| 46 |
+
"negative_prompt": "photograph, digital art, 3d render, blurry, low quality, watermark, text, modern"
|
| 47 |
+
},
|
| 48 |
+
"3D Render": {
|
| 49 |
+
"prompt_suffix": "3d render, octane render, ray tracing, unreal engine 5, highly detailed, professional 3d, volumetric lighting",
|
| 50 |
+
"negative_prompt": "2d, flat, painting, sketch, blurry, low quality, watermark, text, logo, deformed"
|
| 51 |
+
},
|
| 52 |
+
"Portrait": {
|
| 53 |
+
"prompt_suffix": "portrait photography, professional lighting, sharp focus, detailed face, professional headshot, 85mm lens, bokeh",
|
| 54 |
+
"negative_prompt": "full body, landscape, blurry, low quality, watermark, text, bad anatomy, extra fingers, deformed face"
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
# Aspect Ratios - OPTIMIZED FOR CPU (smaller sizes)
|
| 59 |
+
ASPECT_RATIOS = {
|
| 60 |
+
"Square (1:1)": (768, 768), # Reduced from 1024
|
| 61 |
+
"Portrait (3:4)": (640, 832), # Reduced proportionally
|
| 62 |
+
"Landscape (4:3)": (832, 640), # Reduced proportionally
|
| 63 |
+
"Wide (16:9)": (896, 512), # Reduced proportionally
|
| 64 |
+
"Ultrawide (21:9)": (1024, 448) # Reduced proportionally
|
| 65 |
+
}
|
| 66 |
+
|
| 67 |
+
# Negative Prompt Base
|
| 68 |
+
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"
|