-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
The method for safe search detection has been changed. I made a few changes to the code in order to complete this tutorial: https://github.com/GoogleCloudPlatform/nodejs-docs-samples/blob/master/functions/imagemagick/index.js. This is my first Github contribution (ever), so let me know if/how to proceed.
- Added new
const requestimmediately after theconst filedeclaration.
const request = {
source: {
imageUri: `gs://${object.bucket}/${file.name}`
}
};- Changed method name in line 44 from
vision.detectSafeSearch(file)tovision.safeSearchDetection(request) - Updated the evaluation for determining an inappropriate image to account for new format of JSON response. Now looks for adult and violence outcomes of VERY_LIKELY or LIKELY.
.then((results) => {
const detections = results[0].safeSearchAnnotation;
if (detections.adult == 'VERY_LIKELY' || detections.adult == 'LIKELY' || detections.violence == 'VERY_LIKELY' || detections.violence == 'LIKELY') {
console.log(`The image ${file.name} has been detected as inappropriate.`);
return blurImage(file);
} else {
console.log(`The image ${file.name} has been detected as OK.`);
}
});
```javascriptsursani and imstand
Metadata
Metadata
Assignees
Labels
No labels