update nudenet

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-04-09 13:48:54 +02:00
parent f1d2888f10
commit 14ba5e4ce7
8 changed files with 85 additions and 43 deletions
+2 -1
View File
@@ -42,11 +42,12 @@ def prompt_check(
def image_guard(
image: str = Body("", title='input image'),
policy: str = Body("", title='optional policy definition'),
model: str = Body("", title='optional policy model name'),
):
"""Evaluate an image against a content policy using the ImageGuard classifier."""
from scripts.nudenet import imageguard # pylint: disable=no-name-in-module
image = api.decode_base64_to_image(image)
res = imageguard.image_guard(image=image, policy=policy)
res = imageguard.image_guard(image=image, policy=policy, model_name=model)
return res
+1 -1
View File
@@ -23,7 +23,7 @@ def display(e: Exception, task: str, suppress=None):
suppress = []
if isinstance(e, ErrorLimiterAbort):
return
log.critical(f"{task or 'error'}: {type(e).__name__}")
log.error(f"{task or 'error'}: {type(e).__name__}")
"""
trace = traceback.format_exc()
log.error(trace)
+3
View File
@@ -29,6 +29,9 @@ class PostprocessImageArgs:
def __init__(self, image):
self.image = image
def __str__(self):
return f'PostprocessImageArgs(image={self.image})'
class PostprocessBatchListArgs:
def __init__(self, images):
+3
View File
@@ -11,6 +11,9 @@ class PostprocessedImage:
self.image = image
self.info = info
def __str__(self):
return f'PostprocessedImage(image={self.image} info={self.info})'
class ScriptPostprocessing:
filename = None