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

Function detectWebGeoGCS

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

Source from the content-addressed store, hash-verified

587}
588
589async function detectWebGeoGCS(bucketName, fileName) {
590 // [START vision_web_detection_include_geo_gcs]
591 // Imports the Google Cloud client library
592 const vision = require('@google-cloud/vision');
593
594 // Creates a client
595 const client = new vision.ImageAnnotatorClient();
596
597 /**
598 * TODO(developer): Uncomment the following lines before running the sample.
599 */
600 // const bucketName = 'Bucket where the file resides, e.g. my-bucket';
601 // const fileName = 'Path to file within bucket, e.g. path/to/image.png';
602
603 const request = {
604 image: {
605 source: {
606 imageUri: `gs://${bucketName}/${fileName}`,
607 },
608 },
609 imageContext: {
610 webDetectionParams: {
611 includeGeoResults: true,
612 },
613 },
614 };
615
616 // Detect similar images on the web to a remote file
617 const [result] = await client.webDetection(request);
618 const webDetection = result.webDetection;
619 webDetection.webEntities.forEach(entity => {
620 console.log(`Score: ${entity.score}`);
621 console.log(`Description: ${entity.description}`);
622 });
623 // [END vision_web_detection_include_geo_gcs]
624}
625
626async function detectFulltext(fileName) {
627 // [START vision_fulltext_detection]

Callers 1

detect.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected