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

deepai

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deepai

[![npm version](https://img.shields.io/npm/v/deepai.svg?style=flat-square)](https://www.npmjs.org/package/deepai)

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4K
increased by7.54%
Maintainers
1
Weekly downloads
 
Created
Source

DeepAI JS Client

npm version

Simple Javascript Client Library for Deep AI's APIs from Browser and Node.js

Installation:

Node.js or other environments using npm:

npm install --save deepai

Browser:

  • Option 1: (Recommended) Load the library from DeepAI's CDN:
    <script src="https://cdnjs.deepai.org/deepai.min.js"></script>
    
  • Option 2: Download and copy "dist/deepai.min.js" into your HTML
  • Option 3: include this npm package, use webpack or browserify, and "require('deepai'')"

Usage Examples:

Most examples are for Content Moderation, but you can subsitute any model name available at DeepAI.

Ensure that you pass the correct input names. Not all model input names are "image".

All examples use Async-Await syntax, so ensure you run the code in an async function.

####Browser:

// Ensure you load deepai with one of the methods in "Installation"
deepai.setApiKey('YOUR_API_KEY'); // get your free API key at https://deepai.org

Pass URL:

var result = await deepai.callStandardApi("content-moderation", {
    image: "https://YOUR_IMAGE_URL"
});

Pass Literal Text:

var result = await deepai.callStandardApi("sentiment-analysis", {
    text: "I am very happy to play with the newest APIs!"
});

Pass Image DOM Element:

var result = await deepai.callStandardApi("content-moderation", {
    image: document.getElementById('yourImageId')
});

Pass File Picker Element:

var result = await deepai.callStandardApi("content-moderation", {
    image: document.getElementById('yourFilePickerId')
});

####Node.js

const deepai = require('deepai');
deepai.setApiKey('YOUR_API_KEY'); // get your free API key at https://deepai.org

Pass URL:

var result = await deepai.callStandardApi("content-moderation", {
    image: "https://YOUR_IMAGE_URL"
});

Pass Literal Text:

var result = await deepai.callStandardApi("sentiment-analysis", {
    text: "I am very happy to play with the newest APIs!"
});

Pass File Upload:

const fs = require('fs');

<...>

var result = await deepai.callStandardApi("content-moderation", {
    image: fs.createReadStream('/path/to/your/file.jpg')
});

Build this library (not required for users of this libary):

npm install
npm run-script build

FAQs

Package last updated on 24 Dec 2018

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