diff options
author | catalpaaa <89681913+catalpaaa@users.noreply.github.com> | 2023-05-01 18:59:21 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-01 18:59:21 +0000 |
commit | 9eb5b3e90f1775af81c828f19e7caded70ba8884 (patch) | |
tree | 4630848311b90277462842669274852f7f6a972a /modules/script_callbacks.py | |
parent | ecdc6471e7d694ef9ecec96e8c3128237efe069a (diff) | |
parent | 72cd27a13587c9579942577e9e3880778be195f6 (diff) | |
download | stable-diffusion-webui-gfx803-9eb5b3e90f1775af81c828f19e7caded70ba8884.tar.gz stable-diffusion-webui-gfx803-9eb5b3e90f1775af81c828f19e7caded70ba8884.tar.bz2 stable-diffusion-webui-gfx803-9eb5b3e90f1775af81c828f19e7caded70ba8884.zip |
Merge branch 'experimental' into subpath-support
Diffstat (limited to 'modules/script_callbacks.py')
-rw-r--r-- | modules/script_callbacks.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/modules/script_callbacks.py b/modules/script_callbacks.py index 07911876..17109732 100644 --- a/modules/script_callbacks.py +++ b/modules/script_callbacks.py @@ -93,6 +93,7 @@ callback_map = dict( callbacks_infotext_pasted=[],
callbacks_script_unloaded=[],
callbacks_before_ui=[],
+ callbacks_on_reload=[],
)
@@ -109,6 +110,14 @@ def app_started_callback(demo: Optional[Blocks], app: FastAPI): report_exception(c, 'app_started_callback')
+def app_reload_callback():
+ for c in callback_map['callbacks_on_reload']:
+ try:
+ c.callback()
+ except Exception:
+ report_exception(c, 'callbacks_on_reload')
+
+
def model_loaded_callback(sd_model):
for c in callback_map['callbacks_model_loaded']:
try:
@@ -254,6 +263,11 @@ def on_app_started(callback): add_callback(callback_map['callbacks_app_started'], callback)
+def on_before_reload(callback):
+ """register a function to be called just before the server reloads."""
+ add_callback(callback_map['callbacks_on_reload'], callback)
+
+
def on_model_loaded(callback):
"""register a function to be called when the stable diffusion model is created; the model is
passed as an argument; this function is also called when the script is reloaded. """
|