Thafx commited on
Commit
6b2718d
1 Parent(s): 4db70d1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -11,8 +11,7 @@ scheduler = DPMSolverMultistepScheduler.from_pretrained(model_id, subfolder="sch
11
  pipe = StableDiffusionPipeline.from_pretrained(
12
  model_id,
13
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
14
- scheduler=scheduler,
15
- pipe.safety_checker=lambda )
16
 
17
  pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
18
  model_id,
@@ -96,6 +95,11 @@ def img_to_img(prompt, neg_prompt, img, strength, guidance, steps, width, height
96
 
97
  return result.images[0]
98
 
 
 
 
 
 
99
  css = """.main-div div{display:inline-flex;align-items:center;gap:.8rem;font-size:1.75rem}.main-div div h1{font-weight:900;margin-bottom:7px}.main-div p{margin-bottom:10px;font-size:94%}a{text-decoration:underline}.tabs{margin-top:0;margin-bottom:0}#gallery{min-height:20rem}
100
  """
101
  with gr.Blocks(css=css) as demo:
 
11
  pipe = StableDiffusionPipeline.from_pretrained(
12
  model_id,
13
  torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
14
+ scheduler=scheduler)
 
15
 
16
  pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
17
  model_id,
 
95
 
96
  return result.images[0]
97
 
98
+ def fake_safety_checker(images, **kwargs):
99
+ return result.images[0], [False] * len(images)
100
+
101
+ pipe.safety_checker = fake_safety_checker
102
+
103
  css = """.main-div div{display:inline-flex;align-items:center;gap:.8rem;font-size:1.75rem}.main-div div h1{font-weight:900;margin-bottom:7px}.main-div p{margin-bottom:10px;font-size:94%}a{text-decoration:underline}.tabs{margin-top:0;margin-bottom:0}#gallery{min-height:20rem}
104
  """
105
  with gr.Blocks(css=css) as demo: