Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

imagine-client-js

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imagine-client-js

A Nodejs client for doc.ai's Imagine API

  • 0.2.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Imagine Client for NodeJS

This library allows you to easily connect to doc.ai's Imagine API.

Supported Image Models

Model IdTypeDescription
phenomenal-faceimageGiven a facial image, this model infers the age, sex, height and weight of a person
happy-faceimageGiven a facial image, this model infers the mood of a person

API

client.getImageModel(modelId)

Given a string (modelId), gets the image model. See the "Supported Image Models" section for a list of supported model ids

imageModel.infer(fsReadStream, shouldStoreImage, metadata)

Performs the model's inference on an image. A read stream should be passed as the parameter (fsReadStream).

imageModel.inferByType(data, type, shouldStoreImage, metadata)

Performs the model's inference on an image. A data should be passed as the parameter (data) and type should specify the format that the data is in. (base64 is currently supported)

imageModel.correctionLabel(correctionObj, metadata)

Uploads a correction label to the imagine API, for a given inference.

imageModel.predictionLabel(correctionObj, metadata)

(FOR EDGE PREDICTIONS) Uploads a prediction label to the imagine API, for a given inference.

Example


const fs = require('fs');
const ImagineClient = require('imagine-client-nodejs');

// Initialize imagine client
const client = new ImagineClient({
  apiKey: '1234567890',
  clientId: '3ad839e3-90e7-4564-b3a1-5e39c88545a5'
});

// Get a reference to the 'happy-face' model
const model = client.getImageModel('happy-face');

// Create a read stream to a image file
const imageStream = fs.createReadStream('face.png');

// Perform the model's inference, on the image.
return model.infer(imageStream, false)
  .then((result) => {
    // Print the result
    console.log(result);
  });

FAQs

Package last updated on 03 May 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc