multimodalart HF staff commited on
Commit
d14d357
1 Parent(s): 0272460

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -14,6 +14,10 @@ image_encoder_path = "laion/CLIP-ViT-H-14-laion2B-s32B-b79K"
14
  ip_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid_sd15.bin", repo_type="model")
15
  ip_plus_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid-plusv2_sd15.bin", repo_type="model")
16
 
 
 
 
 
17
  device = "cuda"
18
 
19
  noise_scheduler = DDIMScheduler(
@@ -31,6 +35,8 @@ pipe = StableDiffusionPipeline.from_pretrained(
31
  torch_dtype=torch.float16,
32
  scheduler=noise_scheduler,
33
  vae=vae,
 
 
34
  )
35
 
36
  ip_model = IPAdapterFaceID(pipe, ip_ckpt, device)
 
14
  ip_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid_sd15.bin", repo_type="model")
15
  ip_plus_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid-plusv2_sd15.bin", repo_type="model")
16
 
17
+ safety_model_id = "CompVis/stable-diffusion-safety-checker"
18
+ safety_feature_extractor = AutoFeatureExtractor.from_pretrained(safety_model_id)
19
+ safety_checker = StableDiffusionSafetyChecker.from_pretrained(safety_model_id)
20
+
21
  device = "cuda"
22
 
23
  noise_scheduler = DDIMScheduler(
 
35
  torch_dtype=torch.float16,
36
  scheduler=noise_scheduler,
37
  vae=vae,
38
+ feature_extractor=safety_feature_extractor,
39
+ safety_checker=safety_checker
40
  )
41
 
42
  ip_model = IPAdapterFaceID(pipe, ip_ckpt, device)