DGSpitzer commited on
Commit
2e2e46f
1 Parent(s): dd77d14

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -46,13 +46,15 @@ def inference(prompt, guidance, steps):
46
 
47
  promptPrev = prompt
48
  prompt = prompt_prefixes[current_model] + prompt
49
- image = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images[0]
 
50
  return image, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(placeholder=promptPrev)
51
 
52
  def inference_example(prompt, guidance, steps):
53
 
54
  prompt = prompt_prefixes[current_model] + prompt
55
- image = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512).images[0]
 
56
  return image
57
 
58
  css = """
 
46
 
47
  promptPrev = prompt
48
  prompt = prompt_prefixes[current_model] + prompt
49
+ results = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512)
50
+ image = results.images[0] if not results.nsfw_content_detected[0] else Image.open("nsfw_placeholder.jpg")
51
  return image, gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(placeholder=promptPrev)
52
 
53
  def inference_example(prompt, guidance, steps):
54
 
55
  prompt = prompt_prefixes[current_model] + prompt
56
+ results = pipe(prompt, num_inference_steps=int(steps), guidance_scale=guidance, width=512, height=512)
57
+ image = results.images[0] if not results.nsfw_content_detected[0] else Image.open("nsfw_placeholder.jpg")
58
  return image
59
 
60
  css = """