Created
October 30, 2020 12:45
-
-
Save zachgoll/ecc4fa7b98768b803d9634eadc5952f6 to your computer and use it in GitHub Desktop.
vision-api example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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