mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 17:24:32 +02:00
update ar and gallery permissions
This commit is contained in:
@@ -105,7 +105,7 @@ def register_api(app: FastAPI): # register api
|
||||
folders = [f for f in folders if os.path.isdir(f)]
|
||||
if shared.demo is not None:
|
||||
for f in folders:
|
||||
if os.path.isabs(f) and f not in shared.demo.allowed_paths:
|
||||
if f not in shared.demo.allowed_paths:
|
||||
debug(f'Browser folders allow: {f}')
|
||||
shared.demo.allowed_paths.append(quote(f))
|
||||
debug(f'Browser folders: {folders}')
|
||||
|
||||
@@ -56,6 +56,7 @@ 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)
|
||||
try:
|
||||
@@ -69,6 +70,20 @@ def ar_change(ar, width, 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)
|
||||
"""
|
||||
if ar == 'AR':
|
||||
return gr.update(), gr.update()
|
||||
try:
|
||||
(w, h) = [float(x) for x in ar.split(':')]
|
||||
except Exception as e:
|
||||
shared.log.warning(f"Invalid aspect ratio: {ar} {e}")
|
||||
return gr.update(), gr.update()
|
||||
if w > h:
|
||||
return gr.update(), gr.update(value=int(width * h / w))
|
||||
elif w < h:
|
||||
return gr.update(value=int(height * w / h)), gr.update()
|
||||
else:
|
||||
return gr.update(), gr.update()
|
||||
|
||||
|
||||
def create_resolution_inputs(tab):
|
||||
|
||||
Reference in New Issue
Block a user