Created
May 12, 2017 05:41
-
-
Save wagyu298/6ebc0daa27c3565cb256827bbcdd891f to your computer and use it in GitHub Desktop.
AWS Rekognition detectModerationLabels example for Node.js
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
#!/usr/bin/env node | |
const request = require('request'); | |
const AWS = require('aws-sdk'); | |
const rekognition = new AWS.Rekognition({ | |
// Detect moderation labels is available on AWS region us-east-1, us-west-2 and eu-west-1 | |
region: "us-west-2", | |
accessKeyId: "YOUR accessKeyId", | |
secretAccessKey: "YOUR secretAccessKey" | |
}); | |
const url = process.argv[2]; | |
request({ | |
method: "GET", | |
url: url, | |
encoding: null | |
}, (err, response, body) => { | |
if (err) { | |
console.error(err); | |
process.exit(1); | |
} | |
rekognition.detectModerationLabels({ | |
Image: { | |
Bytes: body, | |
}, | |
MinConfidence: 0.0 | |
}, (err, data) => { | |
if (err) { | |
console.log(err); | |
process.exit(1); | |
} | |
console.log(data); | |
process.exit(0); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment