radames commited on
Commit
8fd9ced
β€’
1 Parent(s): 10f783d

checks if nsfw_content_detected exists

Browse files

checks if nsfw_content_detected exists, make it compatible with v2 diffusers models, they don't come with safety_checker

Files changed (1) hide show
  1. template/app_advanced.py +1 -1
template/app_advanced.py CHANGED
@@ -83,7 +83,7 @@ def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height
83
  def replace_nsfw_images(results):
84
 
85
  for i in range(len(results.images)):
86
- if results.nsfw_content_detected[i]:
87
  results.images[i] = Image.open("nsfw.png")
88
  return results.images[0]
89
 
 
83
  def replace_nsfw_images(results):
84
 
85
  for i in range(len(results.images)):
86
+ if 'nsfw_content_detected' in results and results.nsfw_content_detected[i]:
87
  results.images[i] = Image.open("nsfw.png")
88
  return results.images[0]
89