diff options
author | AUTOMATIC <16777216c@gmail.com> | 2022-12-10 11:54:02 +0000 |
---|---|---|
committer | AUTOMATIC <16777216c@gmail.com> | 2022-12-10 11:54:16 +0000 |
commit | 991e2dcee9d6baa66b5c0b1969c4c07407be933a (patch) | |
tree | 8cde65654885dc069aee99994f12ae14ba1aac98 /modules/scripts.py | |
parent | d06592267c745b4732026c4e0c499c9a4b3900a1 (diff) | |
download | stable-diffusion-webui-gfx803-991e2dcee9d6baa66b5c0b1969c4c07407be933a.tar.gz stable-diffusion-webui-gfx803-991e2dcee9d6baa66b5c0b1969c4c07407be933a.tar.bz2 stable-diffusion-webui-gfx803-991e2dcee9d6baa66b5c0b1969c4c07407be933a.zip |
remove NSFW filter and its dependency; if you still want it, find it in the extensions section
Diffstat (limited to 'modules/scripts.py')
-rw-r--r-- | modules/scripts.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/scripts.py b/modules/scripts.py index b934d881..23ca195d 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -88,6 +88,17 @@ class Script: pass
+ def postprocess_batch(self, p, *args, **kwargs):
+ """
+ Same as process_batch(), but called for every batch after it has been generated.
+
+ **kwargs will have same items as process_batch, and also:
+ - batch_number - index of current batch, from 0 to number of batches-1
+ - images - torch tensor with all generated images, with values ranging from 0 to 1;
+ """
+
+ pass
+
def postprocess(self, p, processed, *args):
"""
This function is called after processing ends for AlwaysVisible scripts.
@@ -347,6 +358,15 @@ class ScriptRunner: print(f"Error running postprocess: {script.filename}", file=sys.stderr)
print(traceback.format_exc(), file=sys.stderr)
+ def postprocess_batch(self, p, images, **kwargs):
+ for script in self.alwayson_scripts:
+ try:
+ script_args = p.script_args[script.args_from:script.args_to]
+ script.postprocess_batch(p, *script_args, images=images, **kwargs)
+ except Exception:
+ print(f"Error running postprocess_batch: {script.filename}", file=sys.stderr)
+ print(traceback.format_exc(), file=sys.stderr)
+
def before_component(self, component, **kwargs):
for script in self.scripts:
try:
|