fofr / illusions

Create illusions with img2img and masking support

  • Public
  • 48.4K runs
  • L40S
  • GitHub

Run fofr/illusions with an API

Use one of our client libraries to get started quickly.

Set the REPLICATE_API_TOKEN environment variable

export REPLICATE_API_TOKEN=<paste-your-token-here>

Learn more about authentication

Install Replicate’s Node.js client library

npm install replicate
Learn more about setup

Run fofr/illusions using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.

import Replicate from "replicate";
const replicate = new Replicate();

const input = {
    seed: -1,
    image: "https://replicate.delivery/pbxt/JouANiZNiW2mwouIgIk1VySvjL9MBmaPD6Ib8HyfW81CJzRR/out-0-44.png",
    control_image: "https://replicate.delivery/pbxt/JouAO2zaHgb66YVChJagSYz0LcGqv3QgG4BS71mioFbBHWTZ/spiral_black_transparent-2513050263.jpg",
    prompt_strength: 0.75
};

const output = await replicate.run("fofr/illusions:579b32db82b24584c3c6155fe3ae12e8fce50ba28b575c23e8a1f5f3a5e99ed8", { input });

import { writeFile } from "node:fs/promises";
for (const [index, item] of Object.entries(output)) {
  await writeFile(`output_${index}.png`, item);
}
//=> output_0.png written to disk
Learn more