typefile
{
"background": "https://replicate.delivery/pbxt/MGREFtOoq1mHLtFubZD9jrM0PfGuaGbrI9Z9lbHns7YFdsdi/replicate-prediction-8hepgs9evnrga0cm69rbpaehv8.jpg",
"foreground": "https://replicate.delivery/pbxt/MGREFYPiuQLuj97mLLuBHlKkNHwg8yggdk4fgQT3zxrU6ABM/cologne.png"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_MbK**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run lucataco/merge-img using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"lucataco/merge-img:4bf046472cc6a669bd7881a5598288500fcc1e7a20b2f3547cb2ddd545f0d3c3",
{
input: {
background: "https://replicate.delivery/pbxt/MGREFtOoq1mHLtFubZD9jrM0PfGuaGbrI9Z9lbHns7YFdsdi/replicate-prediction-8hepgs9evnrga0cm69rbpaehv8.jpg",
foreground: "https://replicate.delivery/pbxt/MGREFYPiuQLuj97mLLuBHlKkNHwg8yggdk4fgQT3zxrU6ABM/cologne.png"
}
}
);
// To access the file URL:
console.log(output.url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output);
To learn more, take a look at the guide on getting started with Node.js.
pip install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_MbK**********************************
This is your API token. Keep it to yourself.
import replicate
Run lucataco/merge-img using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"lucataco/merge-img:4bf046472cc6a669bd7881a5598288500fcc1e7a20b2f3547cb2ddd545f0d3c3",
input={
"background": "https://replicate.delivery/pbxt/MGREFtOoq1mHLtFubZD9jrM0PfGuaGbrI9Z9lbHns7YFdsdi/replicate-prediction-8hepgs9evnrga0cm69rbpaehv8.jpg",
"foreground": "https://replicate.delivery/pbxt/MGREFYPiuQLuj97mLLuBHlKkNHwg8yggdk4fgQT3zxrU6ABM/cologne.png"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_MbK**********************************
This is your API token. Keep it to yourself.
Run lucataco/merge-img using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
curl -s -X POST \
-H "Authorization: Bearer $REPLICATE_API_TOKEN" \
-H "Content-Type: application/json" \
-H "Prefer: wait" \
-d $'{
"version": "lucataco/merge-img:4bf046472cc6a669bd7881a5598288500fcc1e7a20b2f3547cb2ddd545f0d3c3",
"input": {
"background": "https://replicate.delivery/pbxt/MGREFtOoq1mHLtFubZD9jrM0PfGuaGbrI9Z9lbHns7YFdsdi/replicate-prediction-8hepgs9evnrga0cm69rbpaehv8.jpg",
"foreground": "https://replicate.delivery/pbxt/MGREFYPiuQLuj97mLLuBHlKkNHwg8yggdk4fgQT3zxrU6ABM/cologne.png"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "qx4yjvm44xrga0cm69rbsfn6er",
"model": "lucataco/merge-img",
"version": "4bf046472cc6a669bd7881a5598288500fcc1e7a20b2f3547cb2ddd545f0d3c3",
"input": {
"background": "https://replicate.delivery/pbxt/MGREFtOoq1mHLtFubZD9jrM0PfGuaGbrI9Z9lbHns7YFdsdi/replicate-prediction-8hepgs9evnrga0cm69rbpaehv8.jpg",
"foreground": "https://replicate.delivery/pbxt/MGREFYPiuQLuj97mLLuBHlKkNHwg8yggdk4fgQT3zxrU6ABM/cologne.png"
},
"logs": "",
"output": "https://replicate.delivery/czjl/iBGMqaOyyTasGVS3o7Zyaa3qhwXlMT5dlpGtTvQxLjgBncAF/output.jpg",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-01-04T17:50:22.247Z",
"started_at": "2025-01-04T17:51:02.519728Z",
"completed_at": "2025-01-04T17:51:02.908004Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/qx4yjvm44xrga0cm69rbsfn6er/cancel",
"get": "https://api.replicate.com/v1/predictions/qx4yjvm44xrga0cm69rbsfn6er",
"stream": "https://stream.replicate.com/v1/files/fddq-fjsob3pyl442h2juljfhbargilp2emn5nuehep4lagniivgml72q",
"web": "https://replicate.com/p/qx4yjvm44xrga0cm69rbsfn6er"
},
"metrics": {
"predict_time": 0.38827531,
"total_time": 40.661004
}
}

