Created
August 10, 2020 00:33
-
-
Save geek-at/f3bef4ad6158b30865caed0fe40425b3 to your computer and use it in GitHub Desktop.
Node JS example for nsfw-categorize.it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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