MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / detectSafeSearchGCS

Function detectSafeSearchGCS

vision/detect.js:361–385  ·  view source on GitHub ↗
(bucketName, fileName)

Source from the content-addressed store, hash-verified

359}
360
361async function detectSafeSearchGCS(bucketName, fileName) {
362 // [START vision_safe_search_detection_gcs]
363 // Imports the Google Cloud client libraries
364 const vision = require('@google-cloud/vision');
365
366 // Creates a client
367 const client = new vision.ImageAnnotatorClient();
368
369 /**
370 * TODO(developer): Uncomment the following lines before running the sample.
371 */
372 // const bucketName = 'Bucket where the file resides, e.g. my-bucket';
373 // const fileName = 'Path to file within bucket, e.g. path/to/image.png';
374
375 // Performs safe search property detection on the remote file
376 const [result] = await client.safeSearchDetection(
377 `gs://${bucketName}/${fileName}`
378 );
379 const detections = result.safeSearchAnnotation;
380 console.log(`Adult: ${detections.adult}`);
381 console.log(`Spoof: ${detections.spoof}`);
382 console.log(`Medical: ${detections.medical}`);
383 console.log(`Violence: ${detections.violence}`);
384 // [END vision_safe_search_detection_gcs]
385}
386
387async function detectCropHints(fileName) {
388 // [START vision_crop_hint_detection]

Callers 1

detect.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected