NSFW Classification

FREEMIUM
By nanonets
Updated 3 months ago
Machine Learning
1.4/10
Popularity Score
606ms
Latency
-
Success Rate

NSFW Classification API Documentation

Classify an image into safe-for-work(sfw -- adult content free) or not-safe-for-work(nsfw -- porn, gore, nudity).

View API Details
POSTNSFW Inference
POSTNSFW Inference

Returns a probability between 0 - 1 for both nsfw and the sfw labels

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
AuthorizationSTRING
REQUIREDBasic Auth header with Nanonets API Key generated after logging in at app.nanonets as username and password as empty
Required Parameters
fileBINARY
REQUIREDfile stream of the file(s) that need to be inferred
model_idSTRING
REQUIRED
Code Snippet
unirest.post("https://nsfw-classification.p.rapidapi.com/ImageCategorization/LabelFile/?model_id=353cea12-4dcc-47ee-b139-dd345157b17d")
.header("X-RapidAPI-Host", "nsfw-classification.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.attach("file", fs.createReadStream("undefined"))
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
General
Request URL: https://nsfw-classification.p.rapidapi.com/ImageCategorization/LabelFile/
Request Method: POST
Response Headers
Response Body

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.post("https://nsfw-classification.p.rapidapi.com/ImageCategorization/LabelFile/?model_id=353cea12-4dcc-47ee-b139-dd345157b17d")
.header("X-RapidAPI-Host", "nsfw-classification.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.attach("file", fs.createReadStream("undefined"))
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication