Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function detectHandwritingGCS(uri) {
// [START vision_handwritten_ocr_gcs_beta]
// Imports the Google Cloud client libraries
const vision = require('@google-cloud/vision').v1p3beta1;
const fs = require('fs');
// Creates a client
const client = new vision.ImageAnnotatorClient();
/**
* TODO(developer): Uncomment the following line before running the sample.
*/
// const uri = `gs://bucket/bucketImage.png`;
const request = {
image: {
content: fs.readFileSync(uri),
},
feature: {
languageHints: ['en-t-i0-handwrit'],
},
};
const [result] = await client.documentTextDetection(request);
async function detectHandwritingOCR(fileName) {
// [START vision_handwritten_ocr_beta]
// Imports the Google Cloud client libraries
const vision = require('@google-cloud/vision').v1p3beta1;
const fs = require('fs');
// Creates a client
const client = new vision.ImageAnnotatorClient();
/**
* TODO(developer): Uncomment the following line before running the sample.
*/
// const fileName = `/path/to/localImage.png`;
const request = {
image: {
content: fs.readFileSync(fileName),
},
feature: {
languageHints: ['en-t-i0-handwrit'],
},
};
const [result] = await client.documentTextDetection(request);