jayparmr's picture
Upload 118 files
19b3da3
raw
history blame
538 Bytes
from internals.util.config import get_nsfw_access
class Result:
images, nsfw = None, None
def __init__(self, images, nsfw):
self.images = images
self.nsfw = nsfw
@staticmethod
def from_result(result):
has_nsfw = result.nsfw_content_detected
if has_nsfw and isinstance(has_nsfw, list):
has_nsfw = any(has_nsfw)
has_nsfw = ~get_nsfw_access() and has_nsfw
return (result.images, bool(has_nsfw))
# return Result(result.images, result.has_nsfw_concepts)