Skip to content

Commit

Permalink
Merge pull request #10 from w-e-w/apply-censor-after-composite
Browse files Browse the repository at this point in the history
apply censor after composite
  • Loading branch information
w-e-w authored Jan 21, 2024
2 parents 0e78af3 + 05dbcfb commit 8162bc8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/nudenet_nsfw_censor_scripts/processing_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def title(self):
def show(self, is_img2img):
return scripts.AlwaysVisible

def postprocess_image(self, p, pp, *args):
def postprocess_image_after_composite(self, p, pp, *args):
"""
Detect image with nudenet and apply censor filter selected areas of the pp.image
pp.image will be replaced with censor image if filter is applied
Expand Down Expand Up @@ -98,6 +98,9 @@ def postprocess_image(self, p, pp, *args):
if shared.opts.nudenet_nsfw_censor_gen_filter_type:
pp.image = apply_filter(pp.image, censor_mask, shared.opts.nudenet_nsfw_censor_gen_filter_type, **filter_settings)

if not hasattr(scripts.Script, 'postprocess_image_after_composite'):
postprocess_image = postprocess_image_after_composite

def setup(self, p, *args):
"""
Live preview censor, inject code by wrapping shared.state.assign_current_image()
Expand Down

0 comments on commit 8162bc8

Please sign in to comment.