pnyompen / sd-lineart-controlnet

This AI model generates new images while preserving the original image characteristics by applying Lineart ControlNet to the input image and performing Stable Diffusion's Image2Image generation. Combined with IP-Adapter, it enables generation that better

  • Public
  • 44 runs
Iterate in playground

Input

Run this model in Node.js with one line of code:

npx create-replicate --model=pnyompen/sd-lineart-controlnet
or set up a project from scratch
npm install replicate
Set the REPLICATE_API_TOKEN environment variable:
export REPLICATE_API_TOKEN=<paste-your-token-here>

Find your API token in your account settings.

Import and set up the client:
import Replicate from "replicate";
import fs from "node:fs";

const replicate = new Replicate({
  auth: process.env.REPLICATE_API_TOKEN,
});

Run pnyompen/sd-lineart-controlnet using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.

const output = await replicate.run(
  "pnyompen/sd-lineart-controlnet:cbb04d27d4ecf4817168a85a4cf9670669db0ea543e78022e5c34109e291218c",
  {
    input: {
      color: [0,0,0,0],
      prompt: "An astronaut riding a rainbow unicorn",
      strength: 0.8,
      scheduler: "K_EULER",
      num_outputs: 1,
      guidance_scale: 7.5,
      condition_scale: 1.1,
      negative_prompt: "",
      ip_adapter_scale: 1,
      num_inference_steps: 30
    }
  }
);

// To access the file URL:
console.log(output[0].url()); //=> "http://example.com"

// To write the file to disk:
fs.writeFile("my-image.png", output[0]);

To learn more, take a look at the guide on getting started with Node.js.

Output

No output yet! Press "Submit" to start a prediction.

Run time and cost

This model runs on Nvidia T4 GPU hardware. We don't yet have enough runs of this model to provide performance information.

Readme

This AI model generates new images while preserving the original image characteristics by applying Lineart ControlNet to the input image and performing Stable Diffusion’s Image2Image generation. Combined with IP-Adapter, it enables generation that better retains the features of the input image.