@zcatalyst/zia
v0.0.3
Published
JavaScript SDK for Catalyst Zia - AI and Machine Learning Services
Maintainers
Readme
@zcatalyst/zia
JavaScript SDK for Catalyst Zia - AI and Machine Learning Services
Overview
The @zcatalyst/zia package provides JavaScript/TypeScript methods to access Catalyst Zia for OCR, barcode, image moderation, object detection, face, AutoML, and text-analysis APIs. Runs in Node.js (server-side) environments only.
Prerequisites
- A Catalyst project set up
- Understanding of Zia services
- Image files for processing (for OCR, barcode, etc.)
Installation
To install this package, simply type add or install @zcatalyst/zia using your favorite package manager:
npm install @zcatalyst/ziayarn add @zcatalyst/ziapnpm add @zcatalyst/zia
Getting Started
Import
The Catalyst SDK is modularized by Components.
To send a request, you only need to import the Zia:
// ES5 example
const { Zia } = require("@zcatalyst/zia");// ES6+ example
import { Zia } from "@zcatalyst/zia";Usage
To send a request, you:
- Create a Zia Instance.
- Call the Zia operation with input parameters.
const zia = new Zia();
// Example: Scan barcode from image
const result = await zia.scanBarcode(fs.createReadStream('path/to/barcode.png'));Async/await
We recommend using await operator to wait for the promise returned by send operation as follows:
// async/await.
try {
const data = await zia.scanBarcode(fs.createReadStream('sam/barcode.png'));
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}Error Handling
try {
const data = await zia.scanBarcode(fs.createReadStream('sam/barcode.png'));
// process data.
} catch (error) {
const message = error.message;
const status = error.statusCode;
console.log({ message, status });
}Resources
Contributing
See CONTRIBUTING for more information on how to get started.
License
This SDK is distributed under the Apache License 2.0. See LICENSE file for more information.
