Face detection on CPU

#4
by cbensimon HF staff - opened
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -47,11 +47,12 @@ pipe = StableDiffusionPipeline.from_pretrained(
47
  ip_model = IPAdapterFaceID(pipe, ip_ckpt, device)
48
  ip_model_plus = IPAdapterFaceIDPlus(pipe, image_encoder_path, ip_plus_ckpt, device)
49
 
 
 
 
50
  @spaces.GPU(enable_queue=True)
51
  def generate_image(images, prompt, negative_prompt, preserve_face_structure, face_strength, likeness_strength, nfaa_negative_prompt, progress=gr.Progress(track_tqdm=True)):
52
  pipe.to(device)
53
- app = FaceAnalysis(name="buffalo_l", providers=['CUDAExecutionProvider', 'CPUExecutionProvider'])
54
- app.prepare(ctx_id=0, det_size=(640, 640))
55
 
56
  faceid_all_embeds = []
57
  first_iteration = True
 
47
  ip_model = IPAdapterFaceID(pipe, ip_ckpt, device)
48
  ip_model_plus = IPAdapterFaceIDPlus(pipe, image_encoder_path, ip_plus_ckpt, device)
49
 
50
+ app = FaceAnalysis(name="buffalo_l", providers=['CPUExecutionProvider'])
51
+ app.prepare(ctx_id=0, det_size=(640, 640))
52
+
53
  @spaces.GPU(enable_queue=True)
54
  def generate_image(images, prompt, negative_prompt, preserve_face_structure, face_strength, likeness_strength, nfaa_negative_prompt, progress=gr.Progress(track_tqdm=True)):
55
  pipe.to(device)
 
 
56
 
57
  faceid_all_embeds = []
58
  first_iteration = True