ComfyUI换脸节点

github:

https://github.com/Gourieff/ComfyUI-ReActor

关掉nsfw检测,找到custom_nodes\ComfyUI-ReActor\scripts\reactor_sfw.py,修改如下:

def nsfw_image(img_data, model_path: str):
    # 增加这一行直接返回,跳过nsfw检测
    return False
    if not MODEL_EXISTS:
        logger.status("Ensuring NSFW detection model exists...")
        if not ensure_nsfw_model(model_path):
            return True
    device = model_management.get_torch_device()
    with Image.open(io.BytesIO(img_data)) as img:
        if "cpu" in str(device):
            predict = pipeline("image-classification", model=model_path)
        else:
            device_id = 0
            if "cuda" in str(device):
                device_id = int(str(device).split(":")[1])
            predict = pipeline("image-classification", model=model_path, device=device_id)
        result = predict(img)
        if result[0]["label"] == "nsfw" and result[0]["score"] > SCORE:
            logger.status(f'NSFW content detected with score={result[0]["score"]}, skipping...')
            return True
        return False
© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享