The SDK gives you a verdict; your app decides what to do with it. This guide covers the common patterns.
Read the verdict
Every visual result carries a single isUnsafe flag plus the detail you need to decide:
isUnsafeis true when an object is flagged or NSFW isblock. Use it for a simple allow / reject.nsfw(safe,warn,block) lets you treat borderline content differently from explicit content.detectionsandnsfwScoresgive you the specifics for logging, messaging, or tuning.
Text results use blocked, plus category and layer for context.
Choose an action
There is no single right response. Match the action to your product and the verdict.
| Verdict | Typical action |
|---|---|
block / isUnsafe | Reject the upload or message, or replace it with a placeholder |
warn (suggestive) | Blur, add a content warning, or age-gate. Advisory, so many apps allow it |
| Uncertain / borderline | Allow but queue for human review |
safe | Allow |
By surface
Image upload. Check before the image is stored or shown to others. Reject or blur on isUnsafe.
const r = await analyzeImage(path) if (r.isUnsafe) rejectUpload() else if (r.nsfw === 'warn') blurUntilTapped() else allow()
Chat message. Check before the message is sent or displayed. Block on blocked, and use category for the user-facing reason.
const t = await moderateText(message) if (t.blocked) showBlockedNotice(t.category) else send(message)
Live camera. Handle the per-frame result. Because a single frame can flicker, act on the debounced verdict (the SDK already holds it) rather than every raw frame, and remember that a sustained warn escalates to block.
Add a human review step
Automated moderation is the fast first pass; it is not a full trust-and-safety system. For the gray area, keep the sample and route it to your own review queue instead of making a hard decision. A good split:
- Clear
block: act automatically. warnor borderline scores: allow with a soft action (blur, warn) and flag for review.- Clear
safe: allow.
The SDK does not include a review console or user-reporting flow, so pair it with your own reporting and review tooling.
Tune, do not hardcode
If you see misses or false positives for your content, adjust the thresholds rather than adding ad-hoc rules around the result. Lower is stricter.
setNsfwThreshold(explicit, 0.45) // block bar setNsfwThreshold(sexy, 0.55) // warn bar setThreshold(weapon, 0.70) // object class bar
[!TIP] Start from the defaults and change one bar at a time. See How moderation works for what each field means.