PeterL1n commited on
Commit
1ffdbc2
1 Parent(s): 795174e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -49,10 +49,15 @@ def generate(prompt, option, progress=gr.Progress()):
49
 
50
  # Safety check.
51
  feature_extractor_input = image_processor.postprocess(results.images, output_type="pil")
 
52
  safety_checker_input = feature_extractor(feature_extractor_input, return_tensors="pt")
 
 
 
53
  images, has_nsfw_concept = safety_checker(
54
- images=results.images, clip_input=safety_checker_input.pixel_values.to(device, dtype)
55
  )
 
56
  if has_nsfw_concept[0]:
57
  gr.Warning("Safety checker triggered. Image may contain violent or sexual content.")
58
  print(f"Safety checker triggered on prompt: {prompt}")
 
49
 
50
  # Safety check.
51
  feature_extractor_input = image_processor.postprocess(results.images, output_type="pil")
52
+ print("A")
53
  safety_checker_input = feature_extractor(feature_extractor_input, return_tensors="pt")
54
+ print("B")
55
+ pixel_values = safety_checker_input.pixel_values.to(device, dtype)
56
+ print("C")
57
  images, has_nsfw_concept = safety_checker(
58
+ images=results.images, clip_input=pixel_values
59
  )
60
+ print("D")
61
  if has_nsfw_concept[0]:
62
  gr.Warning("Safety checker triggered. Image may contain violent or sexual content.")
63
  print(f"Safety checker triggered on prompt: {prompt}")