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

Function extractDescriptions

vision/textDetection.js:166–174  ·  view source on GitHub ↗

* Grab the description, and push it into redis. * @param {string} filename Name of the file being processed * @param {Index} index The Index object that wraps Redis * @param {*} response Individual response from the Cloud Vision API * @returns {Promise }

(filename, index, response)

Source from the content-addressed store, hash-verified

164 * @returns {Promise<void>}
165 */
166async function extractDescriptions(filename, index, response) {
167 if (response.textAnnotations.length) {
168 const words = extractDescription(response.textAnnotations);
169 await index.add(filename, words);
170 } else {
171 console.log(`${filename} had no discernable text.`);
172 await index.setContainsNoText(filename);
173 }
174}
175
176/**
177 * Given a set of image file paths, extract the text and run them through the

Callers 1

getTextFromFilesFunction · 0.85

Calls 3

extractDescriptionFunction · 0.85
addMethod · 0.80
setContainsNoTextMethod · 0.80

Tested by

no test coverage detected