Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
3e15f8e0
Commit
3e15f8e0
authored
Oct 25, 2022
by
AUTOMATIC
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update callbacks code for #3549
parent
91c1e1e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
modules/script_callbacks.py
modules/script_callbacks.py
+16
-6
No files found.
modules/script_callbacks.py
View file @
3e15f8e0
...
...
@@ -49,6 +49,14 @@ def ui_settings_callback():
report_exception
(
c
,
'ui_settings_callback'
)
def
image_saved_callback
(
image
,
p
,
fullfn
,
txt_fullfn
):
for
c
in
callbacks_image_saved
:
try
:
c
.
callback
(
image
,
p
,
fullfn
,
txt_fullfn
)
except
Exception
:
report_exception
(
c
,
'image_saved_callback'
)
def
add_callback
(
callbacks
,
fun
):
stack
=
[
x
for
x
in
inspect
.
stack
()
if
x
.
filename
!=
__file__
]
filename
=
stack
[
0
]
.
filename
if
len
(
stack
)
>
0
else
'unknown file'
...
...
@@ -56,9 +64,6 @@ def add_callback(callbacks, fun):
callbacks
.
append
(
ScriptCallback
(
filename
,
fun
))
def
image_saved_callback
(
image
,
p
,
fullfn
,
txt_fullfn
):
for
callback
in
callbacks_image_saved
:
callback
(
image
,
p
,
fullfn
,
txt_fullfn
)
def
on_model_loaded
(
callback
):
"""register a function to be called when the stable diffusion model is created; the model is
...
...
@@ -82,9 +87,14 @@ def on_ui_tabs(callback):
def
on_ui_settings
(
callback
):
"""register a function to be called before UI settings are populated; add your settings
by using shared.opts.add_option(shared.OptionInfo(...)) """
callbacks_ui_settings
.
append
(
callback
)
add_callback
(
callbacks_ui_settings
,
callback
)
def
on_save_imaged
(
callback
):
"""register a function to call after modules.images.save_image is called returning same values, original image and p """
callbacks_image_saved
.
append
(
callback
)
"""register a function to be called after modules.images.save_image is called.
The callback is called with three arguments:
- p - procesing object (or a dummy object with same fields if the image is saved using save button)
- fullfn - image filename
- txt_fullfn - text file with parameters; may be None
"""
add_callback
(
callbacks_image_saved
,
callback
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment