npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

deepai

v1.0.23

Published

[![npm version](https://img.shields.io/npm/v/deepai.svg?style=flat-square)](https://www.npmjs.org/package/deepai) [![CodeQL](https://github.com/deepai-org/deepai-js-client/actions/workflows/codeql.yml/badge.svg)](https://github.com/deepai-org/deepai-js-cl

Downloads

14,837

Readme

DeepAI JS Client

npm version CodeQL

The official Javascript Client Library for accessing Deep AI's advanced machine learning models. Designed for both browser and Node.js environments.

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, bundle with tools like webpack or browserify, and use require('deepai').

Usage Examples:

Most examples are for NSFW Detector (nsfw-detector), but you can substitute any model name from the DeepAI model list.

Ensure that you pass the correct input names. They vary based on the model. Refer to each model's documentation on DeepAI.org for specifics.

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

Browser:

Initialize and set your API key:

deepai.setApiKey("YOUR_API_KEY"); // Obtain your API key from https://deepai.org

Pass URL: Using the Super Resolution model:

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

Pass Literal Text: For the Text Generation model:

var result = await deepai.callStandardApi("text-generator", {
  text: "Your long article or text goes here.",
});

Pass Image DOM Element: Using the NSFW Detector model:

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

Pass File Picker Element: Using the Waifu 2x model:

var result = await deepai.callStandardApi("waifu2x", {
  image: document.getElementById("yourFilePickerId"),
});

Node.js:

Initialize and set your API key:

const deepai = require("deepai");
deepai.setApiKey("YOUR_API_KEY"); // Obtain your API key from https://deepai.org

Pass URL: Using the NSFW Detector model:

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

Pass Literal Text: For the Text Generation model:

var result = await deepai.callStandardApi("text-generator", {
  text: "Your long article or text goes here.",
});

Pass File Upload: Using the NSFW Detector model:

const fs = require('fs');

// ...

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

Text to Image Options:

For all "Text to Image" models, the following options are available:

text:

(Required) A string, URL, or binary text file that serves as the main prompt for the image generation.

negative_prompt:

(Optional) A string to indicate elements you'd like to be removed from or avoided in the image.

Can be used to enhance image quality and details.

Example negative prompts:

bad anatomy, bad proportions, blurry, cloned face, cropped, deformed, dehydrated, disfigured, duplicate, error, extra arms, extra fingers, extra legs, extra limbs, fused fingers, gross proportions, jpeg artifacts, long neck, low quality, lowres, malformed limbs, missing arms, missing legs, morbid, mutated hands, mutation, mutilated, out of frame, poorly drawn face, poorly drawn hands, signature, text, too many fingers, ugly, username, watermark, worst quality.

grid_size:

(Optional) Pass a string, either "1" or "2".

“2” is the default, which returns a 2x2 grid with 4 images. Pass “1” to only receive 1 image.

width, height:

(Optional) Pass a string, e.g., "256" or "768". Default is "512". Acceptable values range between 128 and 1536. Note: values above approximately 700 or below 256 may produce strange outputs.

Example:

{
	"text": "A serene beach at sunset",
	"negative_prompt": "No people",
	"grid_size": "4x4",
	"width": "1024",
	"height": "768"
}

Adjust these options to customize the output according to your requirements.

Available Models:

Text to Text:

  • Text Generator (text-generator)

Image to Text:

  • NSFW Detector (nsfw-detector)
  • Image Similarity (image-similarity)

Text to Image:

  • Text to Image (text2img)
  • Stable Diffusion (stable-diffusion)
  • Cute Creature Generator (cute-creature-generator)
  • Fantasy World Generator (fantasy-world-generator)
  • Cyberpunk Generator (cyberpunk-generator)
  • Anime Portrait Generator (anime-portrait-generator)
  • Old Style Generator (old-style-generator)
  • Renaissance Painting Generator (renaissance-painting-generator)
  • Abstract Painting Generator (abstract-painting-generator)
  • Impressionism Painting Generator (impressionism-painting-generator)
  • Surreal Graphics Generator (surreal-graphics-generator)
  • 3D Objects Generator (3d-objects-generator)
  • Origami 3D Generator (origami-3d-generator)
  • Hologram 3D Generator (hologram-3d-generator)
  • 3D Character Generator (3d-character-generator)
  • Watercolor Painting Generator (watercolor-painting-generator)
  • Pop Art Generator (pop-art-generator)
  • Contemporary Architecture Generator (contemporary-architecture-generator)
  • Future Architecture Generator (future-architecture-generator)
  • Watercolor Architecture Generator (watercolor-architecture-generator)
  • Fantasy Character Generator (fantasy-character-generator)
  • Steampunk Generator (steampunk-generator)
  • Logo Generator (logo-generator)
  • Pixel Art Generator (pixel-art-generator)
  • Street Art Generator (street-art-generator)
  • Surreal Portrait Generator (surreal-portrait-generator)
  • Anime World Generator (anime-world-generator)
  • Fantasy Portrait Generator (fantasy-portrait-generator)
  • Comics Portrait Generator (comics-portrait-generator)
  • Cyberpunk Portrait Generator (cyberpunk-portrait-generator)

Image to Image:

  • Super Resolution (torch-srgan)
  • Waifu2x (waifu2x)
  • Colorizer (colorizer)

Development:

Build & Publish:

For contributors and maintainers of the library:

npm install
npm run-script build
npm login
npm publish

More Information:

The browser-based build uses the webpack-generated code in dist/. The Node.js environment utilizes the code in the lib folder, which can also function in the browser, for instance, in a React webpack application.

For more detailed documentation, model explanations, and FAQs, visit DeepAI.org.

License:

MIT License