aboutsummaryrefslogtreecommitdiffstats
path: root/modules/api/api.py
diff options
context:
space:
mode:
authorVespinian <vespinian@proton.me>2023-03-25 18:11:46 +0000
committerVespinian <vespinian@proton.me>2023-03-25 18:11:46 +0000
commitf3715795710b3b39029325b88a2c101279c2dd2c (patch)
tree8fc25ab091800d3e1b3d359c22e3399ff3d1d1d5 /modules/api/api.py
parentdb602b100e271e902e120fa8aa5c859e3ef3962f (diff)
downloadstable-diffusion-webui-gfx803-f3715795710b3b39029325b88a2c101279c2dd2c.tar.gz
stable-diffusion-webui-gfx803-f3715795710b3b39029325b88a2c101279c2dd2c.tar.bz2
stable-diffusion-webui-gfx803-f3715795710b3b39029325b88a2c101279c2dd2c.zip
Revert "Made copies of global scriptrunners, now we clear the copied scriptrunner of alwayson_scripts and only add back the ones that that were requested"
This reverts commit dfa258de5f87ea7f5ff49e29ddf6e7b34ff8ebff.
Diffstat (limited to 'modules/api/api.py')
-rw-r--r--modules/api/api.py16
1 files changed, 3 insertions, 13 deletions
diff --git a/modules/api/api.py b/modules/api/api.py
index afbc202a..35e17afc 100644
--- a/modules/api/api.py
+++ b/modules/api/api.py
@@ -3,7 +3,6 @@ import io
import time
import datetime
import uvicorn
-import copy
from threading import Lock
from io import BytesIO
from gradio.processing_utils import decode_base64_to_file
@@ -203,7 +202,6 @@ class Api:
script_args[0] = 0
# Now check for always on scripts
- alwayson_script_to_run = [] # list to replace the one from the global ScriptRunner we copied
if request.alwayson_scripts and (len(request.alwayson_scripts) > 0):
for alwayson_script_name in request.alwayson_scripts.keys():
alwayson_script = self.get_script(alwayson_script_name, script_runner)
@@ -212,21 +210,13 @@ class Api:
# Selectable script in always on script param check
if alwayson_script.alwayson == False:
raise HTTPException(status_code=422, detail=f"Cannot have a selectable script in the always on scripts params")
- # all good, so add to run list and set its args if any
- alwayson_script_to_run.append(alwayson_script)
+ # always on script with no arg should always run so you don't really need to add them to the requests
if "args" in request.alwayson_scripts[alwayson_script_name]:
script_args[alwayson_script.args_from:alwayson_script.args_to] = request.alwayson_scripts[alwayson_script_name]["args"]
-
- # Remove always on scripts that were not included in the request by resetting the script list in out ScriptRunner
- script_runner.alwayson_scripts.clear()
- script_runner.alwayson_scripts = alwayson_script_to_run
- script_runner.scripts.clear()
- script_runner.scripts = alwayson_script_to_run + script_runner.selectable_scripts
-
return script_args
def text2imgapi(self, txt2imgreq: StableDiffusionTxt2ImgProcessingAPI):
- script_runner = copy.copy(scripts.scripts_txt2img) # copy so we don't overwrite our globals
+ script_runner = scripts.scripts_txt2img
if not script_runner.scripts:
script_runner.initialize_scripts(False)
ui.create_ui()
@@ -278,7 +268,7 @@ class Api:
if mask:
mask = decode_base64_to_image(mask)
- script_runner = copy.copy(scripts.scripts_img2img) # copy so we don't overwrite our globals
+ script_runner = scripts.scripts_img2img
if not script_runner.scripts:
script_runner.initialize_scripts(True)
ui.create_ui()