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

Function detectTextGCS

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

Source from the content-addressed store, hash-verified

178}
179
180async function detectTextGCS(bucketName, fileName) {
181 // [START vision_text_detection_gcs]
182 // Imports the Google Cloud client libraries
183 const vision = require('@google-cloud/vision');
184
185 // Creates a client
186 const client = new vision.ImageAnnotatorClient();
187
188 /**
189 * TODO(developer): Uncomment the following lines before running the sample.
190 */
191 // const bucketName = 'Bucket where the file resides, e.g. my-bucket';
192 // const fileName = 'Path to file within bucket, e.g. path/to/image.png';
193
194 // Performs text detection on the gcs file
195 const [result] = await client.textDetection(`gs://${bucketName}/${fileName}`);
196 const detections = result.textAnnotations;
197 console.log('Text:');
198 detections.forEach(text => console.log(text));
199 // [END vision_text_detection_gcs]
200}
201
202async function detectLogos(fileName) {
203 // [START vision_logo_detection]

Callers 1

detect.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected