Spaces:
Running
on
Zero
Running
on
Zero
Update pipline_StableDiffusionXL_ConsistentID.py
Browse files
pipline_StableDiffusionXL_ConsistentID.py
CHANGED
@@ -261,8 +261,12 @@ class ConsistentIDStableDiffusionXLPipeline(StableDiffusionXLPipeline):
|
|
261 |
attn_processor.scale = scale
|
262 |
|
263 |
@torch.inference_mode()
|
264 |
-
def get_prepare_faceid(self, input_image_path=None):
|
265 |
-
|
|
|
|
|
|
|
|
|
266 |
face_info = self.app.get(faceid_image)
|
267 |
if face_info==[]:
|
268 |
faceid_embeds = torch.zeros_like(torch.empty((1, 512)))
|
@@ -507,7 +511,7 @@ class ConsistentIDStableDiffusionXLPipeline(StableDiffusionXLPipeline):
|
|
507 |
do_classifier_free_guidance = guidance_scale >= 1.0
|
508 |
input_image_file = input_id_images[0]
|
509 |
|
510 |
-
faceid_embeds = self.get_prepare_faceid(input_image_path=input_image_path)
|
511 |
face_caption = self.get_prepare_llva_caption(input_image_file=input_image_file)
|
512 |
key_parsing_mask_list, vis_parsing_anno_color = self.get_prepare_facemask(input_image_file)
|
513 |
|
|
|
261 |
attn_processor.scale = scale
|
262 |
|
263 |
@torch.inference_mode()
|
264 |
+
def get_prepare_faceid(self, input_image_file=None, input_image_path=None):
|
265 |
+
try:
|
266 |
+
faceid_image = cv2.imread(input_image_path)
|
267 |
+
except:
|
268 |
+
faceid_image = np.array(input_image_file) ### use the numpy image
|
269 |
+
|
270 |
face_info = self.app.get(faceid_image)
|
271 |
if face_info==[]:
|
272 |
faceid_embeds = torch.zeros_like(torch.empty((1, 512)))
|
|
|
511 |
do_classifier_free_guidance = guidance_scale >= 1.0
|
512 |
input_image_file = input_id_images[0]
|
513 |
|
514 |
+
faceid_embeds = self.get_prepare_faceid(input_image_file=input_image_file, input_image_path=input_image_path)
|
515 |
face_caption = self.get_prepare_llva_caption(input_image_file=input_image_file)
|
516 |
key_parsing_mask_list, vis_parsing_anno_color = self.get_prepare_facemask(input_image_file)
|
517 |
|