mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
allow custom aspect ratio values
This commit is contained in:
+3
-1
@@ -22,6 +22,7 @@
|
||||
- see [wiki](https://github.com/vladmandic/automatic/wiki/Stable-Cascade) for details
|
||||
- currently requires 10GB VRAM, lighter version is in development
|
||||
- **Visual Query** visual query & answer in process tab
|
||||
- go to process -> visual query
|
||||
- ask your questions, e.g. "describe the image", "what is behind the subject", "what are predominant colors of the image?"
|
||||
- primary model is [moondream2](https://github.com/vikhyat/moondream), a *tiny* 1.86B vision language model
|
||||
*note*: its still 3.7GB in size, so not really tiny
|
||||
@@ -48,7 +49,8 @@
|
||||
EDM is a new solver algorithm currently available for DPM++2M and Euler samplers
|
||||
Note that using EDM samplers with non-EDM optimized models will provide just noise and vice-versa
|
||||
- **UI**
|
||||
- *aspect-ratio** add selector and lock to width/height control
|
||||
- *aspect-ratio** add selector and lock to width/height control
|
||||
allowed aspect ration can be configured via *settings -> user interface*
|
||||
- *interrogate* tab is now merged into *process* tab
|
||||
- *image viewer* now displays image metadata
|
||||
- *themes* improve on-the-fly switching
|
||||
|
||||
@@ -574,6 +574,7 @@ options_templates.update(options_section(('ui', "User Interface Options"), {
|
||||
"theme_style": OptionInfo("Auto", "Theme mode", gr.Radio, {"choices": ["Auto", "Dark", "Light"]}),
|
||||
"font_size": OptionInfo(14, "Font size", gr.Slider, {"minimum": 8, "maximum": 32, "step": 1, "visible": True}),
|
||||
"tooltips": OptionInfo("UI Tooltips", "UI tooltips", gr.Radio, {"choices": ["None", "Browser default", "UI tooltips"], "visible": False}),
|
||||
"aspect_ratios": OptionInfo("1:1, 4:3, 16:9, 16:10, 21:9, 3:4, 9:16, 10:16, 9:21", "Allowed aspect ratios"),
|
||||
"compact_view": OptionInfo(False, "Compact view"),
|
||||
"return_grid": OptionInfo(True, "Show grid in results"),
|
||||
"return_mask": OptionInfo(False, "Inpainting include greyscale mask in results"),
|
||||
|
||||
+11
-5
@@ -58,11 +58,15 @@ def create_toprow(is_img2img: bool = False, id_part: str = None):
|
||||
def ar_change(ar, width, height):
|
||||
if ar == 'AR':
|
||||
return gr.update(interactive=True), gr.update(interactive=True)
|
||||
(w, h) = [int(x) for x in ar.split(':')]
|
||||
try:
|
||||
(w, h) = [int(x) for x in ar.split(':')]
|
||||
except Exception as e:
|
||||
shared.log.warning(f"Invalid aspect ratio: {ar} {e}")
|
||||
return gr.update(interactive=True), gr.update(interactive=True)
|
||||
if w > h:
|
||||
return gr.update(interactive=True, value=width), gr.update(interactive=False, value=int(width * int(h) / int(w)))
|
||||
return gr.update(interactive=True, value=width), gr.update(interactive=False, value=int(width * h / w))
|
||||
elif w < h:
|
||||
return gr.update(interactive=False, value=int(height * int(w) / int(h))), gr.update(interactive=True, value=height)
|
||||
return gr.update(interactive=False, value=int(height * w / h)), gr.update(interactive=True, value=height)
|
||||
else:
|
||||
return gr.update(interactive=True, value=width), gr.update(interactive=False, value=width)
|
||||
|
||||
@@ -70,7 +74,8 @@ def ar_change(ar, width, height):
|
||||
def create_resolution_inputs(tab):
|
||||
width = gr.Slider(minimum=64, maximum=4096, step=8, label="Width", value=512, elem_id=f"{tab}_width")
|
||||
height = gr.Slider(minimum=64, maximum=4096, step=8, label="Height", value=512, elem_id=f"{tab}_height")
|
||||
ar_dropdown = gr.Dropdown(show_label=False, interactive=True, choices=["AR", "1:1", "4:3", "16:9", "16:10", "21:9", "3:4", "9:16", "10:16", "9:21"], value="AR", elem_id=f"{tab}_ar", elem_classes=["ar-dropdown"])
|
||||
ar_list = ['AR'] + [x.strip() for x in shared.opts.aspect_ratios.split(',') if x.strip() != '']
|
||||
ar_dropdown = gr.Dropdown(show_label=False, interactive=True, choices=ar_list, value=ar_list[0], elem_id=f"{tab}_ar", elem_classes=["ar-dropdown"])
|
||||
for c in [ar_dropdown, width, height]:
|
||||
c.change(fn=ar_change, inputs=[ar_dropdown, width, height], outputs=[width, height], show_progress=False)
|
||||
res_switch_btn = ToolButton(value=ui_symbols.switch, elem_id=f"{tab}_res_switch_btn", label="Switch dims")
|
||||
@@ -262,7 +267,8 @@ def create_resize_inputs(tab, images, scale_visible=True, mode=None, accordion=T
|
||||
with gr.Row():
|
||||
width = gr.Slider(minimum=64, maximum=8192, step=8, label="Width", value=512, elem_id=f"{tab}_width")
|
||||
height = gr.Slider(minimum=64, maximum=8192, step=8, label="Height", value=512, elem_id=f"{tab}_height")
|
||||
ar_dropdown = gr.Dropdown(scale=1, show_label=False, interactive=True, choices=["AR", "1:1", "4:3", "16:9", "16:10", "21:9", "3:4", "9:16", "10:16", "9:21"], value="AR", elem_id=f"{tab}_ar", elem_classes=["ar-dropdown"])
|
||||
ar_list = ['AR'] + [x.strip() for x in shared.opts.aspect_ratios.split(',') if x.strip() != '']
|
||||
ar_dropdown = gr.Dropdown(show_label=False, interactive=True, choices=ar_list, value=ar_list[0], elem_id=f"{tab}_ar", elem_classes=["ar-dropdown"])
|
||||
for c in [ar_dropdown, width, height]:
|
||||
c.change(fn=ar_change, inputs=[ar_dropdown, width, height], outputs=[width, height], show_progress=False)
|
||||
res_switch_btn = ToolButton(value=ui_symbols.switch, elem_id=f"{tab}_res_switch_btn")
|
||||
|
||||
Reference in New Issue
Block a user