From be2e8d549a235090ee27dafb9b5ba247a3688e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gourieff=20=7C=20=E5=8F=A4=E4=BB=81?= Date: Mon, 26 May 2025 23:22:51 +0700 Subject: [PATCH] UPD: Less annoying msgs --- nodes.py | 7 ++++--- scripts/reactor_sfw.py | 1 - scripts/reactor_swapper.py | 15 ++++++++++----- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/nodes.py b/nodes.py index f21c049..bc1f685 100644 --- a/nodes.py +++ b/nodes.py @@ -237,13 +237,13 @@ class reactor: total_images = image_np.shape[0] out_images = [] - + pbar = progress_bar(total_images) for i in range(total_images): - if total_images > 1: - logger.status(f"Restoring {i}") + # if total_images > 1: + # logger.status(f"Restoring {i}") cur_image_np = image_np[i,:, :, ::-1] @@ -365,6 +365,7 @@ class reactor: pil_images = batch_tensor_to_pil(input_image) # NSFW checker + logger.status("Checking for any unsafe content...") pbar = progress_bar(len(pil_images)) pil_images_sfw = [] for img in pil_images: diff --git a/scripts/reactor_sfw.py b/scripts/reactor_sfw.py index 25648c9..9c092e3 100644 --- a/scripts/reactor_sfw.py +++ b/scripts/reactor_sfw.py @@ -39,7 +39,6 @@ def nsfw_image(img_data, model_path: str): logger.status("Ensuring NSFW detection model exists...") if not ensure_nsfw_model(model_path): return True - logger.status("Checking for any unsafe content...") device = model_management.get_torch_device() with Image.open(io.BytesIO(img_data)) as img: if "cpu" in str(device): diff --git a/scripts/reactor_swapper.py b/scripts/reactor_swapper.py index e7165d6..7a1e5fb 100644 --- a/scripts/reactor_swapper.py +++ b/scripts/reactor_swapper.py @@ -472,6 +472,11 @@ def swap_face_many( target_faces = [] pbar = progress_bar(len(target_imgs)) + if len(TARGET_IMAGE_LIST_HASH) > 0: + logger.status(f"Using Hashed Target Face(s) Model...") + else: + logger.status(f"Analyzing Target Image...") + for i, target_img in enumerate(target_imgs): if state.interrupted or model_management.processing_interrupted(): logger.status("Interrupted by User") @@ -493,19 +498,19 @@ def swap_face_many( logger.info("(Image %s) Target Image the Same? %s", i, target_image_same) if len(TARGET_FACES_LIST) == 0: - logger.status(f"Analyzing Target Image {i}...") + # logger.status(f"Analyzing Target Image {i}...") target_face = analyze_faces(target_img) TARGET_FACES_LIST = [target_face] elif len(TARGET_FACES_LIST) == i and not target_image_same: - logger.status(f"Analyzing Target Image {i}...") + # logger.status(f"Analyzing Target Image {i}...") target_face = analyze_faces(target_img) TARGET_FACES_LIST.append(target_face) elif len(TARGET_FACES_LIST) != i and not target_image_same: - logger.status(f"Analyzing Target Image {i}...") + # logger.status(f"Analyzing Target Image {i}...") target_face = analyze_faces(target_img) TARGET_FACES_LIST[i] = target_face elif target_image_same: - logger.status("(Image %s) Using Hashed Target Face(s) Model...", i) + # logger.status("(Image %s) Using Hashed Target Face(s) Model...", i) target_face = TARGET_FACES_LIST[i] @@ -554,11 +559,11 @@ def swap_face_many( if source_face is not None and src_wrong_gender == 0: # Reading results to make current face swap on a previous face result + logger.status(f"Swapping...") for i, (target_img, target_face) in enumerate(zip(results, target_faces)): target_face_single, wrong_gender = get_face_single(target_img, target_face, face_index=face_num, gender_target=gender_target, order=faces_order[0]) if target_face_single is not None and wrong_gender == 0: result = target_img - logger.status(f"Swapping {i}...") if face_boost_enabled: logger.status(f"Face Boost is enabled") bgr_fake, M = face_swapper.get(target_img, target_face_single, source_face, paste_back=False)