anzorq radames commited on
Commit
5708566
1 Parent(s): 10f783d

checks if nsfw_content_detected exists (#2)

Browse files

- checks if nsfw_content_detected exists (8fd9ced2634660a37689d081c712c0566facc8ea)


Co-authored-by: Radamés Ajna <radames@users.noreply.huggingface.co>

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