Skip to content

Instantly share code, notes, and snippets.

@zachgoll
Created October 30, 2020 12:45
Show Gist options
  • Select an option

  • Save zachgoll/ecc4fa7b98768b803d9634eadc5952f6 to your computer and use it in GitHub Desktop.

Select an option

Save zachgoll/ecc4fa7b98768b803d9634eadc5952f6 to your computer and use it in GitHub Desktop.
vision-api example
async function analyzeText(url) {
// Imports the Google Cloud client library
const vision = require("@google-cloud/vision");
// Creates a client
const client = new vision.ImageAnnotatorClient();
const request = {
image: {
source: { imageUri: url },
},
};
// Performs textual recognition analysis on the image file
try {
const result = await client.textDetection(request);
return result[0];
} catch (err) {
console.log(err);
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment