From d631cfe49183eab0f3d741317a98d9ca7ca5b3bd Mon Sep 17 00:00:00 2001 From: lllyasviel Date: Sun, 8 Oct 2023 15:11:46 -0700 Subject: [PATCH] minor (#582) --- fooocus_version.py | 2 +- modules/sdxl_styles.py | 15 ++++++++++++++- webui.py | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/fooocus_version.py b/fooocus_version.py index 05a2dd1..1a1ed23 100644 --- a/fooocus_version.py +++ b/fooocus_version.py @@ -1 +1 @@ -version = '2.1.07' +version = '2.1.08' diff --git a/modules/sdxl_styles.py b/modules/sdxl_styles.py index f5a75bb..56aca25 100644 --- a/modules/sdxl_styles.py +++ b/modules/sdxl_styles.py @@ -966,7 +966,20 @@ SD_XL_BASE_RATIOS = { "3.0": (1728, 576), } -aspect_ratios = {str(v[0]) + '×' + str(v[1]): v for k, v in SD_XL_BASE_RATIOS.items()} +aspect_ratios = {} +default_aspect_ratio = None + +# import math + +for k, (w, h) in SD_XL_BASE_RATIOS.items(): + txt = f'{w}×{h}' + + # gcd = math.gcd(w, h) + # txt += f' {w//gcd}:{h//gcd}' + + aspect_ratios[txt] = (w, h) + if k == "1.29": + default_aspect_ratio = txt def apply_style(style, positive): diff --git a/webui.py b/webui.py index 89b6430..917bddb 100644 --- a/webui.py +++ b/webui.py @@ -12,7 +12,7 @@ import modules.gradio_hijack as grh import modules.advanced_parameters as advanced_parameters import comfy.model_management as model_management -from modules.sdxl_styles import style_keys, aspect_ratios, fooocus_expansion, default_styles +from modules.sdxl_styles import style_keys, aspect_ratios, fooocus_expansion, default_styles, default_aspect_ratio def generate_clicked(*args): @@ -162,7 +162,7 @@ with shared.gradio_root: with gr.Tab(label='Setting'): performance_selection = gr.Radio(label='Performance', choices=['Speed', 'Quality'], value='Speed') aspect_ratios_selection = gr.Radio(label='Aspect Ratios', choices=list(aspect_ratios.keys()), - value='1152×896', info='width × height') + value=default_aspect_ratio, info='width × height') 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.", info='Describing objects that you do not want to see.')