Syntax change

pull/4722/head
awsr 2026-03-30 20:08:50 -07:00
parent 95dadab5c3
commit 3dd09fde08
No known key found for this signature in database
1 changed files with 3 additions and 2 deletions

View File

@ -37,10 +37,11 @@ def check_grid_size(imgs: list[Image.Image] | list[list[Image.Image]] | None):
def get_grid_size(imgs: list, batch_size=1, rows: int | None = None, cols: int | None = None): def get_grid_size(imgs: list, batch_size=1, rows: int | None = None, cols: int | None = None):
rows_int, cols_int = len(imgs), len(imgs) rows_int, cols_int = len(imgs), len(imgs)
if rows is None and cols is None: if rows is None and cols is None:
if n_rows := shared.opts.n_rows >= 0: n_rows, n_cols = shared.opts.n_rows, shared.opts.n_cols
if n_rows >= 0:
rows_int: int = batch_size if n_rows == 0 else n_rows rows_int: int = batch_size if n_rows == 0 else n_rows
cols_int = math.ceil(len(imgs) / rows_int) cols_int = math.ceil(len(imgs) / rows_int)
elif n_cols := shared.opts.n_cols >= 0: elif n_cols >= 0:
cols_int: int = batch_size if n_cols == 0 else n_cols cols_int: int = batch_size if n_cols == 0 else n_cols
rows_int = math.ceil(len(imgs) / cols_int) rows_int = math.ceil(len(imgs) / cols_int)
else: else: