None,"UI Default post processing face restorer (requires restart)",gr.Dropdown,{"interactive":True,"choices":["None"]+[x.name()forxinshared.face_restorers]},section=section))
"Upscaled swapper mask erosion factor, 1 = default behaviour. The larger it is, the more blur is applied around the face. Too large and the facial change is no longer visible.",
False,"Upscaled swapper. Applied only to the swapped faces. Apply transformations before merging with the original image.",gr.Checkbox,{"interactive":True},section=section))
1,"Upscaled swapper mask erosion factor, 1 = default behaviour. The larger it is, the more blur is applied around the face. Too large and the facial change is no longer visible.",gr.Slider,{"minimum":0,"maximum":10,"step":0.001},section=section))
logger.error("Loading of swapping model failed, please check the requirements (On Windows, download and install Visual Studio. During the install, make sure to include the Python and C++ packages.)")
logger.error(
"Loading of swapping model failed, please check the requirements (On Windows, download and install Visual Studio. During the install, make sure to include the Python and C++ packages.)"
)
raiseFaceModelException("Loading of swapping model failed")
logger.error("Loading of swapping model failed, please check the requirements (On Windows, download and install Visual Studio. During the install, make sure to include the Python and C++ packages.)")
logger.error(
"Loading of swapping model failed, please check the requirements (On Windows, download and install Visual Studio. During the install, make sure to include the Python and C++ packages.)"
assertnotnp.array_equal(blended.embedding,faces[0].embedding)iflen(faces)>1elseTrue,"If len(faces)>0, the blended embedding should not be the same than the first image"
"""Process one image and return a List of (image, info) (one if blended, many if not).
Args:
@ -371,8 +413,13 @@ def process_image_unit(model, unit : FaceSwapUnitSettings, image: Image.Image, i
else:
logger.info("blend all faces together")
src_faces=[unit.blended_faces]
assert(notnp.array_equal(unit.reference_face.embedding,src_faces[0].embedding)iflen(unit.faces)>1elseTrue),"Reference face cannot be the same as blended"
assert(all([notnp.array_equal(self._blended_faces.embedding,face.embedding)forfaceinself.faces])iflen(self.faces)>1elseTrue),"Blended faces cannot be the same as one of the face if len(face)>0"
assert(notnp.array_equal(self._blended_faces.embedding,self.reference_face.embedding)iflen(self.faces)>1elseTrue),"Blended faces cannot be the same as reference face if len(face)>0"
assert(
all(
[
notnp.array_equal(
self._blended_faces.embedding,face.embedding
)
forfaceinself.faces
]
)
iflen(self.faces)>1
elseTrue
),"Blended faces cannot be the same as one of the face if len(face)>0"
label="Denoising strenght (will send face to img2img after processing)",
)
inpainting_denoising_prompt=gr.Textbox("Portrait of a [gender]",elem_id="faceswaplab_pp_inpainting_denoising_prompt",label="Inpainting prompt use [gender] instead of men or woman")
inpainting_denoising_negative_prompt=gr.Textbox("",elem_id="faceswaplab_pp_inpainting_denoising_neg_prompt",label="Inpainting negative prompt use [gender] instead of men or woman")
inpaiting_model=gr.Dropdown(choices=["Current"]+sd_models.checkpoint_tiles(),default="Current",label="sd model (experimental)",elem_id="faceswaplab_pp_inpainting_sd_model")