Nodes/Comflowy's Custom Nodes/Replicate falcons-ai/nsfw_image_detection
ComfyUI Node

Replicate falcons-ai/nsfw_image_detection

A cloud NSFW filter for ComfyUI that answers in plain words

By 6174·Created 2 years ago·Updated 2 years ago· 17
Replicate falcons-ai/nsfw_image_detection
  • image
  • STRING
force_rerunfalse

If you generate images in bulk, you eventually want an automatic "should this leave the machine?" check - before a batch goes to print, before it hits a client folder, before it lands somewhere shared. That's what this node is for. It wraps Replicate's falcons-ai/nsfw_image_detection, a fine-tuned Vision Transformer (ViT) trained to classify images, and it answers in the plainest possible way: it hands back a string, "nsfw" or "normal".

It's a nice match for the Comflowy pack's whole deal: this is a model you could run locally (ViTs are small), but you don't have to - the pack runs it server-side and you skip the extra model download and dependency hunt. One image in, one label out, no GPU footprint.

How it works

Like every Replicate <author>/<model> node in this pack, it's generated from the model's OpenAPI schema and proxies through Comflowy's cloud: your image gets base64-encoded, posted to app.comflowy.com with model_type: "replicate" and the pinned model version, Comflowy runs the Replicate job, and the label comes back. There's one input, one output, nothing else to tune.

  • Input: image (IMAGE) - wire in a Load Image. There's also the usual force_rerun toggle, which skips the cached result if you changed something.
  • Output: STRING - the verdict, "nsfw" or "normal".

Using the answer

The string output is where beginners trip. It's just text, so it can't gate your graph by itself - you need a follow-up node that branches on the value, like a text compare or a switch. A typical setup: run your batch through a preview, feed each result here, and let a compare node decide which images make it into your "clean" folder. The classification is per-image, so if you're vetting a batch you'll want to check each one rather than the batch as a whole.

Two honest caveats. First, it's a cloud call, so it costs Comflowy credits per image - cheaper than a generation, but it's not free, which makes it a poor fit for automatically screening thousands of images. Second, it's a single ViT's judgment, not a content-policy oracle; treat it as a first-pass filter, and remember that "normal" doesn't guarantee anything about copyright, faces, or judgment calls a human would make.

Install

Same pack as the rest of Comflowy's nodes:

cd ComfyUI/custom_nodes
git clone https://github.com/6174/comflowy-nodes

Or use ComfyUI Manager and search "Comflowy's Custom Nodes". Restart, set your API key with the Comflowy Set API Key node, and you're filtering. There's no model download and the only real dependency is requests.

Troubleshooting

Because this node's output is a string, a failed request shows up as the error message text rather than a silent blank - the pack's image-outputting nodes quietly return a black placeholder, so a text error here is actually the friendlier failure mode. It usually means the network couldn't reach app.comflowy.com or your API key isn't set. Check those before you suspect the classifier. And if the label feels wrong for something you generated, that's the model being a model: the ViT has a fixed idea of "nsfw," and edge cases (artistic nudity, stylized gore, cartoon content) are exactly where it'll disagree with you.

CategoryComflowy Replicate

Inputs (2)

NameTypeDefaultDescription
imageIMAGE
force_rerunoptBOOLEANfalse

Outputs (1)

NameTypeDescription
STRINGSTRING