Robin7339 commited on
Commit
fe516f0
·
verified ·
1 Parent(s): cce2b06

Update config.py

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