Skip to content

newraina/comfyui-nsfw-detector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ComfyUI NSFW Detector

A ComfyUI custom node that detects NSFW content using Freepik/nsfw_image_detector (EVA-based, ~86MB) and saves images with detection results in the filename.

Node: NSFW Detector + Save Image

Drop-in replacement for SaveImage with built-in NSFW detection.

Inputs

Name Type Description
images IMAGE Input images
filename_prefix STRING Filename prefix (default: ComfyUI)
nsfw_threshold low / medium / high Detection threshold (default: medium). See Threshold levels

Outputs

Name Type Description
images IMAGE Passthrough (for chaining)
nsfw_level STRING Detected level: neutral / low / medium / high
nsfw_score FLOAT Confidence score of the detected level

Threshold levels

The model classifies images into 4 levels: neutral, low, medium, high. The nsfw_threshold parameter controls the minimum level that triggers a flag — images at or above the threshold are flagged.

Threshold Flagged levels Passed levels Strictness
low low, medium, high neutral only Strictest
medium medium, high neutral, low Balanced
high high only neutral, low, medium Most lenient

Filename convention

  • Normal: {prefix}_00001_.png
  • Flagged: {prefix}_flagged_{level}_00001_.png

Installation

Clone into ComfyUI's custom_nodes directory:

cd ComfyUI/custom_nodes
git clone https://github.com/newraina/comfyui-nsfw-detector.git
pip install -r comfyui-nsfw-detector/requirements.txt

Pre-download model

The model is downloaded from HuggingFace on first use by default. To pre-download, place model files in ComfyUI/models/nsfw_detector/:

models/nsfw_detector/
  config.json
  model.safetensors

If you're using comfyui-api, add to manifest.yml:

models:
  before_start:
    - url: https://huggingface.co/Freepik/nsfw_image_detector/resolve/main/config.json
      local_path: models/nsfw_detector/config.json
    - url: https://huggingface.co/Freepik/nsfw_image_detector/resolve/main/model.safetensors
      local_path: models/nsfw_detector/model.safetensors

Releases

No releases published

Packages

 
 
 

Contributors

Languages