diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-09-06 07:11:25 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-09-06 07:11:25 +0000 |
commit | 395f1705979193a0525e1479f0d263e9751e3793 (patch) | |
tree | f18ac2c247a780728aa61972d27170b655ff7579 /scripts/xy_grid.py | |
parent | beece7d85cdcf160a0dc0ba05721d64f6afc867a (diff) | |
download | stable-diffusion-webui-gfx803-395f1705979193a0525e1479f0d263e9751e3793.tar.gz stable-diffusion-webui-gfx803-395f1705979193a0525e1479f0d263e9751e3793.tar.bz2 stable-diffusion-webui-gfx803-395f1705979193a0525e1479f0d263e9751e3793.zip |
readme extras for VRAM for
added missing packages to requirements for #74
add support for negative numbers in X/Y plot (plus ranges) #73
changed progressbar to work properly with custom modes
Diffstat (limited to 'scripts/xy_grid.py')
-rw-r--r-- | scripts/xy_grid.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/xy_grid.py b/scripts/xy_grid.py index 87692983..7f6842b0 100644 --- a/scripts/xy_grid.py +++ b/scripts/xy_grid.py @@ -9,6 +9,7 @@ from modules import images from modules.processing import process_images, Processed
from modules.shared import opts, cmd_opts, state
import modules.sd_samplers
+import re
def apply_field(field):
@@ -89,6 +90,8 @@ def draw_xy_grid(xs, ys, x_label, y_label, cell): return first_pocessed
+re_range = re.compile(r"\s*([+-]?\s*\d+)\s*-\s*([+-]?\s*\d+)(?:\s*\(([+-]\d+)\s*\))?\s*")
+
class Script(scripts.Script):
def title(self):
return "X/Y plot"
@@ -118,11 +121,13 @@ class Script(scripts.Script): valslist_ext = []
for val in valslist:
- if "-" in val:
- s = val.split("-")
- start = int(s[0])
- end = int(s[1])+1
- step = 1 if len(s) < 3 else int(s[2])
+ m = re_range.fullmatch(val)
+ if m is not None:
+
+ start = int(m.group(1))
+ end = int(m.group(2))+1
+ step = int(m.group(3)) if m.group(3) is not None else 1
+
valslist_ext += list(range(start, end, step))
else:
valslist_ext.append(val)
|