visoar / product-photo

generate product images - PixMiller.com

  • Public
  • 6.7K runs
  • L40S

Run visoar/product-photo 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 visoar/product-photo 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 = {
    prompt: "a bag on a magnificent display stand+, with many exquisite decorations+ around it-, creating an elegant and sophisticated atmosphere",
    image_num: 4,
    image_path: "https://replicate.delivery/pbxt/JTPv8xPOK858n7BCcix1FBzLT7P5zOf4qucTTCr9SmPbcD94/0f8212ebeda2e0e10b4ff93bc5aa6821.png",
    product_size: "0.5 * width"
};

const output = await replicate.run("visoar/product-photo:a7be6f87f2d2cd77b134c91a28c18dcfe9754f486437c887920b10adedab6abb", { input });

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