This commit is contained in:
lvmin
2023-10-13 05:28:42 -07:00
parent 80d80c5962
commit 63820ff362
3 changed files with 7 additions and 5 deletions
+5
View File
@@ -119,6 +119,11 @@ checkpoint_downloads = get_config_item_or_set_default(
}, },
validator=lambda x: isinstance(x, dict) and all(isinstance(k, str) and isinstance(v, str) for k, v in x.items()) validator=lambda x: isinstance(x, dict) and all(isinstance(k, str) and isinstance(v, str) for k, v in x.items())
) )
default_aspect_ratio = get_config_item_or_set_default(
key='default_aspect_ratio',
default_value='1152*896',
validator=lambda x: x.replace('*', '×') in modules.sdxl_styles.aspect_ratios
).replace('*', '×')
with open(config_path, "w", encoding="utf-8") as json_file: with open(config_path, "w", encoding="utf-8") as json_file:
json.dump(config_dict, json_file, indent=4) json.dump(config_dict, json_file, indent=4)
-3
View File
@@ -966,7 +966,6 @@ SD_XL_BASE_RATIOS = {
} }
aspect_ratios = {} aspect_ratios = {}
default_aspect_ratio = None
# import math # import math
@@ -977,8 +976,6 @@ for k, (w, h) in SD_XL_BASE_RATIOS.items():
# txt += f' {w//gcd}:{h//gcd}' # txt += f' {w//gcd}:{h//gcd}'
aspect_ratios[txt] = (w, h) aspect_ratios[txt] = (w, h)
if k == "1.29":
default_aspect_ratio = txt
def apply_style(style, positive): def apply_style(style, positive):
+2 -2
View File
@@ -13,7 +13,7 @@ import modules.gradio_hijack as grh
import modules.advanced_parameters as advanced_parameters import modules.advanced_parameters as advanced_parameters
import args_manager import args_manager
from modules.sdxl_styles import legal_style_names, aspect_ratios, default_aspect_ratio from modules.sdxl_styles import legal_style_names, aspect_ratios
from modules.private_logger import get_current_html_path from modules.private_logger import get_current_html_path
@@ -176,7 +176,7 @@ with shared.gradio_root:
with gr.Tab(label='Setting'): with gr.Tab(label='Setting'):
performance_selection = gr.Radio(label='Performance', choices=['Speed', 'Quality'], value='Speed') performance_selection = gr.Radio(label='Performance', choices=['Speed', 'Quality'], value='Speed')
aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=list(aspect_ratios.keys()), aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=list(aspect_ratios.keys()),
value=default_aspect_ratio, info='width × height') value=modules.path.default_aspect_ratio, info='width × height')
image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, step=1, value=2) image_number = gr.Slider(label='Image Number', minimum=1, maximum=32, step=1, value=2)
negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.", negative_prompt = gr.Textbox(label='Negative Prompt', show_label=True, placeholder="Type prompt here.",
info='Describing what you do not want to see.', lines=2, info='Describing what you do not want to see.', lines=2,