diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-14 07:43:18 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2023-08-14 07:43:18 +0000 |
commit | 353c876172a48c5044130249370c9303e611dd8b (patch) | |
tree | 148d9562cc962a3228d59768a8a31ff0c15368fd /modules/scripts.py | |
parent | f3b96d4998d8ca376d33efa7a4454e8c28e24255 (diff) | |
download | stable-diffusion-webui-gfx803-353c876172a48c5044130249370c9303e611dd8b.tar.gz stable-diffusion-webui-gfx803-353c876172a48c5044130249370c9303e611dd8b.tar.bz2 stable-diffusion-webui-gfx803-353c876172a48c5044130249370c9303e611dd8b.zip |
fix API always using -1 as seed
Diffstat (limited to 'modules/scripts.py')
-rw-r--r-- | modules/scripts.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/scripts.py b/modules/scripts.py index cbdac2b5..fcab5d3a 100644 --- a/modules/scripts.py +++ b/modules/scripts.py @@ -68,6 +68,9 @@ class Script: on_after_component_elem_id = None
"""list of callbacks to be called after a component with an elem_id is created"""
+ setup_for_ui_only = False
+ """If true, the script setup will only be run in Gradio UI, not in API"""
+
def title(self):
"""this function should return the title of the script. This is what will be displayed in the dropdown menu."""
@@ -258,7 +261,6 @@ class Script: self.on_after_component_elem_id.append((elem_id, callback))
-
def describe(self):
"""unused"""
return ""
@@ -280,7 +282,8 @@ class Script: pass
-class ScriptBuiltin(Script):
+class ScriptBuiltinUI(Script):
+ setup_for_ui_only = True
def elem_id(self, item_id):
"""helper function to generate id for a HTML element, constructs final id out of tab and user-supplied item_id"""
@@ -728,8 +731,11 @@ class ScriptRunner: except Exception:
errors.report(f"Error running before_hr: {script.filename}", exc_info=True)
- def setup_scrips(self, p):
+ def setup_scrips(self, p, *, is_ui=True):
for script in self.alwayson_scripts:
+ if not is_ui and script.setup_for_ui_only:
+ continue
+
try:
script_args = p.script_args[script.args_from:script.args_to]
script.setup(p, *script_args)
|