-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
61 lines (50 loc) · 2.37 KB
/
config.py
1
2
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
# config.py
import os
from typing import List, Final
import logging
# Image generation settings
RESOLUTIONS: Final[List[int]] = [512, 1024]
NUM_IMAGES_LIST: Final[List[int]] = [1, 4, 9]
INFERENCE_STEPS_LIST: Final[List[int]] = [10, 25, 50]
DEFAULT_TEMPERATURE: Final[float] = 1.0
# File paths
IMAGE_FOLDER: Final[str] = "generated_images"
os.makedirs(IMAGE_FOLDER, exist_ok=True)
# Model names
MODEL_MID_RES: Final[str] = "PixArt-alpha/PixArt-XL-2-512x512"
MODEL_HIGH_RES: Final[str] = "PixArt-alpha/PixArt-XL-2-1024-MS"
UPSCALER_MODEL: Final[str] = "stabilityai/sd-x2-latent-upscaler"
SD_BASE_MODEL: Final[str] = "CompVis/stable-diffusion-v1-4"
FREESTYLE_MODEL: Final[str] = "stabilityai/stable-diffusion-xl-base-1.0"
# ControlNet settings
CONTROLNET_MODEL: Final[str] = "lllyasviel/sd-controlnet-canny"
CONTROLNET_CONDITIONING_SCALE: Final[float] = 0.5
CONTROL_GUIDANCE_START: Final[float] = 0.0
CONTROL_GUIDANCE_END: Final[float] = 1.0
# Freestyle settings
FREESTYLE_PROMPT_JSON: Final[str] = "./style_prompt.json"
FREESTYLE_N: Final[int] = 160
FREESTYLE_B: Final[float] = 2.5
FREESTYLE_S: Final[int] = 1
# User input options
VALID_USER_COMMANDS: Final[set] = {
"regenerate", "reselect", "stop", "continue",
"prompt", "temperature", "restart", "change_num_images"
}
# Enhancement options
ENHANCEMENT_OPTIONS: Final[List[str]] = ["Freestyle", "Upscaler", "ControlNet", "Pixart", "None"]
# Initial prompt (225 chars -> barely truncate)
INITIAL_PROMPT: Final[str] = """
Create an image of two sleek sports cars competing in a high-stakes drift battle in an urban setting at night. The scene features intense drifting with glowing underglow lights, smoking tires, and a crowd of spectators watching from the sidelines.
"""
# Logging configuration
LOG_FORMAT: Final[str] = '%(asctime)s - %(levelname)s - %(message)s'
LOG_DATE_FORMAT: Final[str] = '%Y-%m-%d %H:%M:%S'
LOG_FILE: Final[str] = 'image_generation.log'
MAX_LOG_SIZE: Final[int] = 5 * 1024 * 1024 # 5 MB
BACKUP_COUNT: Final[int] = 3
# User input prompts
TEMPERATURE_PROMPT: Final[str] = "Enter new temperature (suggested range from 0.5 to 1.5): "
INFERENCE_STEPS_PROMPT: Final[str] = "Enter new number of inference steps (10-50 recommended): "
NUM_IMAGES_PROMPT: Final[str] = "Enter new number of images to generate (1-9 recommended): "
ENHANCEMENT_PROMPT: Final[str] = "Select enhancement option (Freestyle/Upscaler/ControlNet/Pixart/None): "