Skip to content

Instantly share code, notes, and snippets.

@AleksandraZuchewicz
Last active April 5, 2020 16:52
Show Gist options
  • Save AleksandraZuchewicz/de91387213e6a8e379759b18473ab0ca to your computer and use it in GitHub Desktop.
Save AleksandraZuchewicz/de91387213e6a8e379759b18473ab0ca to your computer and use it in GitHub Desktop.
Used in: Testing explicit content of the website with Google Cloud Vision API -SafeSearch Detection
const vision = require("@google-cloud/vision");
const fileName = "./screenshots/google.png";
const client = new vision.ImageAnnotatorClient();
(async function save() {
const [result] = await client.safeSearchDetection(fileName);
const detections = result.safeSearchAnnotation;
console.log(`Adult: ${detections.adult}`);
console.log(`Medical: ${detections.medical}`);
console.log(`Spoof: ${detections.spoof}`);
console.log(`Violence: ${detections.violence}`);
console.log(`Racy: ${detections.racy}`);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment