mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
@@ -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
@@ -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)
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user