Merge pull request #1 from wseagar/ws/nsfw_fix

fix: is_nsfw_img is None rather than false
This commit is contained in:
Bryce Drennan 2022-09-15 07:46:25 -07:00 committed by GitHub
commit 8c064587d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -253,8 +253,7 @@ def imagine(
upscaled_img = None upscaled_img = None
is_nsfw_img = None is_nsfw_img = None
if IMAGINAIRY_SAFETY_MODE != SafetyMode.DISABLED: if IMAGINAIRY_SAFETY_MODE != SafetyMode.DISABLED:
if is_nsfw(img, x_sample, half_mode=half_mode): is_nsfw_img = is_nsfw(img, x_sample, half_mode=half_mode)
is_nsfw_img = True
if is_nsfw_img and IMAGINAIRY_SAFETY_MODE == SafetyMode.FILTER: if is_nsfw_img and IMAGINAIRY_SAFETY_MODE == SafetyMode.FILTER:
logger.info(" ⚠️ Filtering NSFW image") logger.info(" ⚠️ Filtering NSFW image")
img = img.filter(ImageFilter.GaussianBlur(radius=40)) img = img.filter(ImageFilter.GaussianBlur(radius=40))