Segmind Node Package Manger

Since the dawn of programming, developers have been on a mission to make our lives easier by sharing handy libraries and modules. They've been all about slashing that boilerplate code and giving us shortcuts to get things done with just a few lines of code.

In the same spirit, we're excited to introduce you to our Node package. They're here to help you dive into the fascinating world of Stable Diffusion Models with minimal fuss. So, let's keep it simple and dive right in!

How to use Segmind NPM

Incorporating Segmind Models into your project has never been easier, thanks to the segmind-npm package. This nifty package opens up a world of possibilities, allowing you to harness a wide array of models with just a few lines of code.

Installation

To get started, you need to import the segmind-npm package into your project. You can do this using npm or yarn:

npm install segmind-npm
# or
yarn add segmind-npm

Initializing the API Key

Before you can generate images, you'll need an API key from cloud.segmind.com. This key will grant you access to Segmind's powerful image generation models. Replace "YOUR API-KEY" with your actual API key in the code below:

import { SDXL, SDXLType } from "segmind-npm"

const apiKey = "YOUR API-KEY";
const sdxl = new SDXL(apiKey);

Generating Images

Now that you have initialized the API key, you can generate images with just a few lines of code. Specify your desired image by providing a prompt, and you can also customize various parameters to control the image generation process:

sdxl.generate({
  prompt: "a panda on a chair",
  style: "base", // Style of the image
  samples: 1, // Number of samples to generate
  scheduler: "UniPC", // Type of scheduler
  num_inference_steps: 25, // Number of denoising steps
  guidance_scale: 8, // Scale for classifier-free guidance
  strength: 0.2, // Transformation strength
  high_noise_fraction: 0.8, // Fraction of inference steps to run
  seed: "468685", // Seed for image generation
  img_width: 1024, // Image width
  img_height: 1024, // Image height
  refiner: true, // Improve image quality
  base64: false, // Base64 encoding of the output image
}).then((response) => {
    // Handle the generated image here
    console.log(response.data);
});

Exported Models

Segmind NPM provides a wide range of exported models that you can use for various image generation tasks. Here is a list of some of the available models:

  • SDXL
  • Flat2D
  • Mix526
  • AllInOnePixel
  • BgRemoval
  • Cartoon
  • Codeformer
  • Colorful
  • Controlnet
  • CuteRichStyle
  • CyberRealistic
  • DeepSpacedDiffusion
  • Dreamshaper
  • DvArch
  • EdgeOfRealism
  • EpicRealism
  • Esrgan
  • Faceswap
  • FantassifiedIcons
  • FruitFusion
  • Icbinp
  • Img2Img
  • Inpainting
  • Juggernaut
  • Kandinsky
  • Majicmix
  • Manmarumix
  • Paragon
  • PotraitSD
  • QRGenerator
  • RCNZ
  • RPG
  • RealisticVision
  • Reliberate
  • Revanimated
  • SDOutpaint
  • Samaritan
  • SciFi
  • SegmentAnything
  • SmallSD
  • TinySD
  • Word2Img

You can choose the model that best suits your specific image generation needs.

Additional Information

For a comprehensive list of API parameters and their descriptions, you can refer to the API documentation on the Segmind website. This will provide you with detailed information on each parameter and how to use them effectively.

With Segmind NPM, you can easily harness the power of Segmind's image generation models to create stunning and customized images for your projects.