GabrielSalem commited on
Commit
00d0ef7
1 Parent(s): ea50e06

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -12
app.py CHANGED
@@ -2,7 +2,6 @@ import torch
2
  import spaces
3
  from diffusers import StableDiffusionPipeline, DDIMScheduler, AutoencoderKL
4
  from transformers import AutoFeatureExtractor
5
- from diffusers.pipelines.stable_diffusion.safety_checker import StableDiffusionSafetyChecker
6
  from ip_adapter.ip_adapter_faceid import IPAdapterFaceID, IPAdapterFaceIDPlus
7
  from huggingface_hub import hf_hub_download
8
  from insightface.app import FaceAnalysis
@@ -16,10 +15,6 @@ image_encoder_path = "laion/CLIP-ViT-H-14-laion2B-s32B-b79K"
16
  ip_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid_sd15.bin", repo_type="model")
17
  ip_plus_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid-plusv2_sd15.bin", repo_type="model")
18
 
19
- safety_model_id = "CompVis/stable-diffusion-safety-checker"
20
- safety_feature_extractor = AutoFeatureExtractor.from_pretrained(safety_model_id)
21
- safety_checker = StableDiffusionSafetyChecker.from_pretrained(safety_model_id)
22
-
23
  device = "cuda"
24
 
25
  noise_scheduler = DDIMScheduler(
@@ -36,14 +31,10 @@ pipe = StableDiffusionPipeline.from_pretrained(
36
  base_model_path,
37
  torch_dtype=torch.float16,
38
  scheduler=noise_scheduler,
39
- vae=vae,
40
- feature_extractor=safety_feature_extractor,
41
- safety_checker=safety_checker
42
  ).to(device)
43
 
44
- #pipe.load_lora_weights("h94/IP-Adapter-FaceID", weight_name="ip-adapter-faceid-plusv2_sd15_lora.safetensors")
45
- #pipe.fuse_lora()
46
-
47
  ip_model = IPAdapterFaceID(pipe, ip_ckpt, device)
48
  ip_model_plus = IPAdapterFaceIDPlus(pipe, image_encoder_path, ip_plus_ckpt, device)
49
 
@@ -134,4 +125,4 @@ with gr.Blocks(css=css) as demo:
134
 
135
  gr.Markdown("This demo includes extra features to mitigate the implicit bias of the model and prevent explicit usage of it to generate content with faces of people, including third parties, that is not safe for all audiences, including naked or semi-naked people.")
136
 
137
- demo.launch()
 
2
  import spaces
3
  from diffusers import StableDiffusionPipeline, DDIMScheduler, AutoencoderKL
4
  from transformers import AutoFeatureExtractor
 
5
  from ip_adapter.ip_adapter_faceid import IPAdapterFaceID, IPAdapterFaceIDPlus
6
  from huggingface_hub import hf_hub_download
7
  from insightface.app import FaceAnalysis
 
15
  ip_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid_sd15.bin", repo_type="model")
16
  ip_plus_ckpt = hf_hub_download(repo_id="h94/IP-Adapter-FaceID", filename="ip-adapter-faceid-plusv2_sd15.bin", repo_type="model")
17
 
 
 
 
 
18
  device = "cuda"
19
 
20
  noise_scheduler = DDIMScheduler(
 
31
  base_model_path,
32
  torch_dtype=torch.float16,
33
  scheduler=noise_scheduler,
34
+ vae=vae
35
+ # Removed feature_extractor and safety_checker
 
36
  ).to(device)
37
 
 
 
 
38
  ip_model = IPAdapterFaceID(pipe, ip_ckpt, device)
39
  ip_model_plus = IPAdapterFaceIDPlus(pipe, image_encoder_path, ip_plus_ckpt, device)
40
 
 
125
 
126
  gr.Markdown("This demo includes extra features to mitigate the implicit bias of the model and prevent explicit usage of it to generate content with faces of people, including third parties, that is not safe for all audiences, including naked or semi-naked people.")
127
 
128
+ demo.launch()