-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed as not planned
Closed as not planned
Copy link
Description
The choice remains to the people who use it. Therefore, I add two bool options in the first two lines of text2img.py, through which you can disable the safety checker or the invisible watermark adder. Decide it by yourself :D
Line 1:
replace_nsfw = False #editable
add_invisi_watermark = False #editable
Line 97:
def check_safety(x_image):
if replace_nsfw:
safety_checker_input = safety_feature_extractor(numpy_to_pil(x_image), return_tensors="pt")
x_checked_image, has_nsfw_concept = safety_checker(images=x_image, clip_input=safety_checker_input.pixel_values)
assert x_checked_image.shape[0] == len(has_nsfw_concept)
for i in range(len(has_nsfw_concept)):
if has_nsfw_concept[i]:
x_checked_image[i] = load_replacement(x_checked_image[i])
else:
x_checked_image, has_nsfw_concept = x_image, None
return x_checked_image, has_nsfw_concept
Line 330 & 347:
if add_invisi_watermark:
img = put_watermark(img, wm_encoder)
Metadata
Metadata
Assignees
Labels
No labels