All Projects → deepai-org → deepai-js-client

deepai-org / deepai-js-client

Licence: BSD-2-Clause License
Simple Javascript Client Library for Browser and Node.js for calling DeepAI's APIs

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to deepai-js-client

CS231n
PyTorch/Tensorflow solutions for Stanford's CS231n: "CNNs for Visual Recognition"
Stars: ✭ 47 (+113.64%)
Mutual labels:  style-transfer
CariMe-pytorch
Unpaired Caricature Generation with Multiple Exaggerations (TMM 2021)
Stars: ✭ 33 (+50%)
Mutual labels:  style-transfer
depth-preserving-neural-style-transfer
Depth-Preserving Style Transfer
Stars: ✭ 86 (+290.91%)
Mutual labels:  style-transfer
awesome style transfer
The style transfer paper collection in International CV conference
Stars: ✭ 42 (+90.91%)
Mutual labels:  style-transfer
tf-adain
TensorFlow implementation of the paper "Arbitrary Style Transfer in Real-time with Adaptive Instance Normalization" by Xun Huang and Serge Belongie
Stars: ✭ 61 (+177.27%)
Mutual labels:  style-transfer
CS231n
My solutions for Assignments of CS231n: Convolutional Neural Networks for Visual Recognition
Stars: ✭ 30 (+36.36%)
Mutual labels:  style-transfer
sRender
Facial Sketch Render, ICASSP 2021
Stars: ✭ 20 (-9.09%)
Mutual labels:  style-transfer
Awesome Neural Style
A curated list of neural style and deep neural network visualization
Stars: ✭ 16 (-27.27%)
Mutual labels:  style-transfer
CNTKUnityTools
Some Deep learning tools in Unity using CNTK
Stars: ✭ 21 (-4.55%)
Mutual labels:  style-transfer
Point-Then-Operate
Code for the ACL 2019 paper ``A Hierarchical Reinforced Sequence Operation Method for Unsupervised Text Style Transfer``
Stars: ✭ 44 (+100%)
Mutual labels:  style-transfer
ada-conv-pytorch
No description or website provided.
Stars: ✭ 46 (+109.09%)
Mutual labels:  style-transfer
neural style synthesizer
No description or website provided.
Stars: ✭ 15 (-31.82%)
Mutual labels:  style-transfer
Splice
Official Pytorch Implementation for "Splicing ViT Features for Semantic Appearance Transfer" presenting "Splice" (CVPR 2022)
Stars: ✭ 126 (+472.73%)
Mutual labels:  style-transfer
Text-to-Speech-Landscape
No description or website provided.
Stars: ✭ 31 (+40.91%)
Mutual labels:  style-transfer
Text-Effects-Transfer
Matlab implementation of the paper "Awesome Typography: Statistics-Based Text Effects Transfer"
Stars: ✭ 40 (+81.82%)
Mutual labels:  style-transfer
groove2groove
Code for "Groove2Groove: One-Shot Music Style Transfer with Supervision from Synthetic Data"
Stars: ✭ 88 (+300%)
Mutual labels:  style-transfer
TET-GAN
[AAAI 2019] TET-GAN: Text Effects Transfer via Stylization and Destylization
Stars: ✭ 74 (+236.36%)
Mutual labels:  style-transfer
PyTorch-deep-photo-styletransfer
PyTorch implementation of "Deep Photo Style Transfer": https://arxiv.org/abs/1703.07511
Stars: ✭ 23 (+4.55%)
Mutual labels:  style-transfer
fast-style-transfer-tutorial-pytorch
Simple Tutorials & Code Implementation of fast-style-transfer(Perceptual Losses for Real-Time Style Transfer and Super-Resolution, 2016 ECCV) using PyTorch.
Stars: ✭ 18 (-18.18%)
Mutual labels:  style-transfer
pytorch-neural-style-transfer-johnson
Reconstruction of the fast neural style transfer (Johnson et al.). Some portions of the paper have been improved by the follow-up work like the instance normalization, etc. Checkout transformer_net.py's header for details.
Stars: ✭ 85 (+286.36%)
Mutual labels:  style-transfer

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 project and include in 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". You can find the correct input name on the page for each model at DeepAI.org

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"),
});
Browser Result Rendering

This code will render the result of the API call into an existing HTML element, such as a div, with the id "yourResultContainerId".

The result will fit itself inside your container, so be sure to set a size on it.

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

await deepai.renderResultIntoElement(
  result,
  document.getElementById("yourResultContainerId")
);
Rendering a result without an extra network request:

The function renderAnnotatedResultIntoElement is for advanced users only.

var resultAnnotated = {
    output_url: <Pass URL of the model output>
    output: <Pass the model output directly in case of JSON or text output>
    id: "fa616aa1-c762-4c98-b44e-75781627974a" <pass your job ID>
    inputs:[
        {
            is_img: true,
            url: (relative or absolute img url, annotations will be rendered on top of this result url.)
        }
    ],
    visualizer_data: {
        list_key: 'Objects', (Name of the list property containing annotations)
        label_key: 'Object' (Name of the value property to label annotations with)
    },
    scale_applied: 1.333 (Scale to multiply all detection x y coordinates by before rendering)
};

deepai.renderAnnotatedResultIntoElement(resultAnnotated, document.getElementById('yourResultContainerId'));

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 & publish this library (not required for users of this libary):

npm install
npm run-script build
npm login
npm publish

How the npm package works:

The webpack generated code (in dist/) is only used in the browser. The code in the lib folder is used in Node.js, although it would also work in the browser (for say, a React webpack app).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].