Spaces:
Running
on
Zero
Running
on
Zero
Update pipline_StableDiffusionXL_ConsistentID.py
Browse files
pipline_StableDiffusionXL_ConsistentID.py
CHANGED
|
@@ -261,15 +261,8 @@ class ConsistentIDStableDiffusionXLPipeline(StableDiffusionXLPipeline):
|
|
| 261 |
attn_processor.scale = scale
|
| 262 |
|
| 263 |
@torch.inference_mode()
|
| 264 |
-
def get_prepare_faceid(self,
|
| 265 |
-
|
| 266 |
-
faceid_image = cv2.imread(input_image_path)
|
| 267 |
-
print(f"input_image_path is : {input_image_path}")
|
| 268 |
-
except:
|
| 269 |
-
faceid_image = np.array(input_image_file) ### use the numpy image
|
| 270 |
-
print(f"input_image_file is : {input_image_file}\r\n")
|
| 271 |
-
|
| 272 |
-
print(f"faceid_image is : {faceid_image}")
|
| 273 |
face_info = self.app.get(faceid_image)
|
| 274 |
if face_info==[]:
|
| 275 |
faceid_embeds = torch.zeros_like(torch.empty((1, 512)))
|
|
@@ -514,7 +507,7 @@ class ConsistentIDStableDiffusionXLPipeline(StableDiffusionXLPipeline):
|
|
| 514 |
do_classifier_free_guidance = guidance_scale >= 1.0
|
| 515 |
input_image_file = input_id_images[0]
|
| 516 |
|
| 517 |
-
faceid_embeds = self.get_prepare_faceid(
|
| 518 |
face_caption = self.get_prepare_llva_caption(input_image_file=input_image_file)
|
| 519 |
key_parsing_mask_list, vis_parsing_anno_color = self.get_prepare_facemask(input_image_file)
|
| 520 |
|
|
@@ -719,13 +712,4 @@ class ConsistentIDStableDiffusionXLPipeline(StableDiffusionXLPipeline):
|
|
| 719 |
if not return_dict:
|
| 720 |
return (image,)
|
| 721 |
|
| 722 |
-
return StableDiffusionXLPipelineOutput(images=image)
|
| 723 |
-
|
| 724 |
-
|
| 725 |
-
|
| 726 |
-
|
| 727 |
-
|
| 728 |
-
|
| 729 |
-
|
| 730 |
-
|
| 731 |
-
|
|
|
|
| 261 |
attn_processor.scale = scale
|
| 262 |
|
| 263 |
@torch.inference_mode()
|
| 264 |
+
def get_prepare_faceid(self, input_image_path=None):
|
| 265 |
+
faceid_image = cv2.imread(input_image_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 266 |
face_info = self.app.get(faceid_image)
|
| 267 |
if face_info==[]:
|
| 268 |
faceid_embeds = torch.zeros_like(torch.empty((1, 512)))
|
|
|
|
| 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 |
|
|
|
|
| 712 |
if not return_dict:
|
| 713 |
return (image,)
|
| 714 |
|
| 715 |
+
return StableDiffusionXLPipelineOutput(images=image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|