martintmv-git/sdxl-lego
Run martintmv-git/sdxl-lego 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
Run martintmv-git/sdxl-lego using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
import { writeFile } from "fs/promises";
import Replicate from "replicate";
const replicate = new Replicate();
const input = {
prompt: "Breaking Bad lego in the style of TOK"
};
const output = await replicate.run("martintmv-git/sdxl-lego:4c082ddfd3e666f9b07f603de33832736b30d27240b67f9a7abc4adc504b6488", { input });
// To access the file URLs:
console.log(output[0].url());
//=> "https://replicate.delivery/.../output_0.png"
// To write the files to disk:
for (const [index, item] of Object.entries(output)) {
await writeFile(`output_${index}.png`, item);
}
//=> output_0.png written to disk