OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Security & Safety

Nsfwjs

Nsfwjs is an open-source TypeScript and JavaScript library that uses TensorFlow.js to classify potentially indecent or NSFW images on the client side, including directly in a browser.

Independent OpenViST project profile, based on linked sources.

Nsfwjs — OpenViST project profile in AI Security & Safety.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use Nsfwjs when an application needs an image classification step inside a JavaScript client or runtime and the developer can handle the returned probabilities in the surrounding workflow.

Who it is for

  • Developers building browser-based image upload workflows
  • Teams adding local content screening to image-sharing applications
  • JavaScript developers working with browser, extension or Node.js environments

Documented uses

  • Classify an image into documented content categories
  • Screen images before they are submitted or published
  • Add a local first-pass check to user-generated image workflows
  • Load bundled or self-hosted TensorFlow.js models for image classification
Before you choose

Requirements & limits

The project is publicly available as an MIT-licensed repository. The supplied material does not document pricing or an account requirement for using the library.

  • Client-side execution can keep the classification step in the browser rather than relying on a hosted moderation service.
  • The library supports MobileNetV2, MobileNetV2Mid and InceptionV3 model options.
  • Developers can use bundled models or host model files at their own URL.
  • TensorFlow.js backend guidance includes WASM, WebGPU and Node.js options.
  • Model dimensions and graph-model handling vary by selected model.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Add a browser image-classification check

Load an Nsfwjs model and classify an image element in a JavaScript application.

Before you start

  • A JavaScript or TypeScript application
  • The nsfwjs package and TensorFlow.js environment
  • An image element available to the application

Steps

  1. Import nsfwjs and obtain the image element.

  2. Load the default model with nsfwjs.load(), or select a documented bundled model.

  3. Call model.classify(img).

  4. Inspect the returned predictions for the five documented categories.

Expected outcome

The application receives category probabilities for the supplied image.

Guide limitations

  • The project states that classification is not perfect.
  • The image must match the requirements of the selected model; documented bundled models include MobileNetV2 at 224×224 and InceptionV3 at 299×299.
  • This recipe describes classification, not a complete publication or enforcement workflow.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
2 October 2026
Original website title
infinitered/nsfwjs · Official homepage title · retained in its source language