Skip to content

Instantly share code, notes, and snippets.

@wagyu298
Created May 12, 2017 05:41
Show Gist options
  • Save wagyu298/6ebc0daa27c3565cb256827bbcdd891f to your computer and use it in GitHub Desktop.
Save wagyu298/6ebc0daa27c3565cb256827bbcdd891f to your computer and use it in GitHub Desktop.
AWS Rekognition detectModerationLabels example for Node.js
#!/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