Juno360219 commited on
Commit
6a85e72
1 Parent(s): 2794a3c
x_checked_image, has_nsfw_concept = check_safety(x_samples_ddim) ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ def check_safety(x_image):
2
+ # safety_checker_input = safety_feature_extractor(numpy_to_pil(x_image), return_tensors="pt")
3
+ # x_checked_image, has_nsfw_concept = safety_checker(images=x_image, clip_input=safety_checker_input.pixel_values)
4
+ # assert x_checked_image.shape[0] == len(has_nsfw_concept)
5
+ # for i in range(len(has_nsfw_concept)):
6
+ # if has_nsfw_concept[i]:
7
+ # x_checked_image[i] = load_replacement(x_checked_image[i])
8
+ # return x_checked_image, has_nsfw_concept
9
+ return x_image, False