Using npm:
The NPM package is available in the following respoitory. Use the following command to install the repository locally.
npm i line-segmentation-algorithm-to-gcp-vision
Input via a JSON file
const fs = require("fs");
const algorithm = require("line-segmentation-algorithm-to-gcp-vision");
// Load the JSON file which has the GCP Response
const content = fs.readFileSync("./S01200HQT173.jpg.json");
// Parse the JSON fine to a variable
const textJson = JSON.parse(content);
// Perform Line Segmentation
console.log(algorithm.initLineSegmentation(textJson[0]['responses'][0]));
Use the response from GCP results
const algo = require("line-segmentation-algorithm-to-gcp-vision");
// call GCP Vision and retrieve results
let gcpResponse = {};
console.log(algo.initLineSegmentation(gcpResponse[0]['responses'][0]));