Skip to content

Instantly share code, notes, and snippets.

@geek-at
Created August 10, 2020 00:33
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Node JS example for nsfw-categorize.it
const request = require('request')
const fs = require('fs');
var req = request.post("https://nsfw-categorize.it/api/upload", function (err, resp, body) {
if (err) {
console.log('Error!');
} else {
var json = JSON.parse(body)
if(json.status=='OK')
console.log("This image has been classified as",json.data.classification)
else console.log("Error",json.reason)
}
});
var form = req.form();
form.append('image', fs.createReadStream('1.jpg'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment