Nodes/NSFW Guard/NSFW Filter Policy (Level 1-4)
ComfyUI Node

NSFW Filter Policy (Level 1-4)

A strictness dial instead of five checkboxes

By vuhung3990·Created 7 months ago·Updated 5 months ago· 2
NSFW Filter Policy (Level 1-4)
    • block_policy
    level3
    level_1Level 1: block porn
    level_2Level 2: block porn + hentai
    level_3Level 3: block porn + hentai + sexy
    level_4Level 4: block porn + hentai + sexy + drawing

    Most people using NSFW Guard don't want to think hard about which of five content classes to block - they want a knob: mild, medium, strict, maximum. That's NSFW Filter Policy (Level 1-4). Set one integer, get a block_policy you can wire into any of the pack's check nodes. It's the same policy mechanism as the label-table node underneath, just with the five checkboxes pre-bundled into four presets.

    How it works

    The level mapping, straight from the README:

    • Level 1 - block porn only.
    • Level 2 - block porn, hentai.
    • Level 3 - block porn, hentai, sexy. This is the default, and it matches the pack's overall documented default policy.
    • Level 4 - block porn, hentai, sexy, drawing. The strictest setting; this also catches anime/manga-style explicit art that the lower levels let through.

    There's no level that blocks normal (safe) images - that would defeat the point of a filter - so level 4 is the ceiling.

    The inputs and outputs that matter

    Only one input actually does anything: level (INT, 1–4, default 3). The four other fields on the node - level_1 through level_4 - look like settings but aren't; each one is an enum with exactly one possible value, which is ComfyUI-speak for "read-only label." They exist so the description of what each number means shows up right on the node itself instead of forcing you to check the README. Don't waste time trying to configure them - there's nothing to configure, just read them.

    One output: block_policy (NSFW_BLOCK_POLICY), which plugs into the optional block_policy input on NSFW Check (HF, Shared Model) or NSFW Check (HF Classifier), or gets superseded if you're relying on NSFW Load Model's own built-in policy instead.

    How to install it

    Same pack, same steps as every node here. ComfyUI Manager: search "NSFW Guard", install, restart. Manual:

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

    then restart. This particular node does no classification itself and needs no model - it just builds a policy object - so it doesn't touch the heavier moderators/transformers dependencies at all; those only matter to the loader and check nodes.

    Common issues & troubleshooting

    You changed level_1 through level_4 and nothing happened. Expected - those fields aren't editable in any way that changes behavior; the schema locks each to a single choice. level is the only control.

    You want asymmetric blocking - say, allow drawings but still block sexy - and level 1–4 won't get you there, because the levels are strictly nested (each one blocks everything the level below it blocks, plus one more class). If you need a policy that doesn't follow that ladder, you want NSFW Filter Policy (Label Table) instead, which gives you all five toggles independently.

    Nothing gets blocked even at level 4. Check that this node's block_policy output is actually wired into the check node's block_policy input - if it's floating, the check node falls back to its own default rather than reading your level setting.

    Categorysafety

    Inputs (5)

    NameTypeDefaultDescription
    levelINT31–4
    level_1COMBOLevel 1: block porn1 options: Level 1: block porn
    level_2COMBOLevel 2: block porn + hentai1 options: Level 2: block porn + hentai
    level_3COMBOLevel 3: block porn + hentai + sexy1 options: Level 3: block porn + hentai + sexy
    level_4COMBOLevel 4: block porn + hentai + sexy + drawing1 options: Level 4: block porn + hentai + sexy + drawing

    Outputs (1)

    NameTypeDescription
    block_policyNSFW_BLOCK_POLICY