diff --git a/modules/processors/frame/face_swapper.py b/modules/processors/frame/face_swapper.py index e0d1c50..5def2ad 100644 --- a/modules/processors/frame/face_swapper.py +++ b/modules/processors/frame/face_swapper.py @@ -105,14 +105,20 @@ def process_frame(source_face: Face, temp_frame: Frame) -> Frame: many_faces = get_many_faces(temp_frame) if many_faces: for target_face in many_faces: - temp_frame = swap_face(source_face, target_face, temp_frame) + if source_face and target_face: + temp_frame = swap_face(source_face, target_face, temp_frame) + else: + print("Face detection failed for target/source.") else: target_face = get_one_face(temp_frame) - if target_face: + if target_face and source_face: temp_frame = swap_face(source_face, target_face, temp_frame) + else: + print("Face detection failed for target or source.") return temp_frame + def process_frame_v2(temp_frame: Frame, temp_frame_path: str = "") -> Frame: if is_image(modules.globals.target_path): if modules.globals.many_faces: