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

Function detectLabelsGCS

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

Source from the content-addressed store, hash-verified

90}
91
92async function detectLabelsGCS(bucketName, fileName) {
93 // [START vision_label_detection_gcs]
94 // Imports the Google Cloud client libraries
95 const vision = require('@google-cloud/vision');
96
97 // Creates a client
98 const client = new vision.ImageAnnotatorClient();
99
100 /**
101 * TODO(developer): Uncomment the following lines before running the sample.
102 */
103 // const bucketName = 'Bucket where the file resides, e.g. my-bucket';
104 // const fileName = 'Path to file within bucket, e.g. path/to/image.png';
105
106 // Performs label detection on the gcs file
107 const [result] = await client.labelDetection(
108 `gs://${bucketName}/${fileName}`
109 );
110 const labels = result.labelAnnotations;
111 console.log('Labels:');
112 labels.forEach(label => console.log(label.description));
113 // [END vision_label_detection_gcs]
114}
115
116async function detectLandmarks(fileName) {
117 // [START vision_landmark_detection]

Callers 1

detect.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected