PeterL1n commited on
Commit
c0376ae
1 Parent(s): 1ffdbc2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -5
app.py CHANGED
@@ -49,17 +49,12 @@ def generate(prompt, option, progress=gr.Progress()):
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}")
64
  return images[0]
65
 
 
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
  pixel_values = safety_checker_input.pixel_values.to(device, dtype)
 
54
  images, has_nsfw_concept = safety_checker(
55
  images=results.images, clip_input=pixel_values
56
  )
 
57
  if has_nsfw_concept[0]:
 
58
  print(f"Safety checker triggered on prompt: {prompt}")
59
  return images[0]
60