Prediction
fottoai/remove-bg:81dc864ca02de47c436ed9f80f971bb21240bff430aeb27ba74916204e90ec49ID
qtkghtn28srga0cmkrqvsa2gwc
Status
Succeeded
Source
Web
Hardware
T4
Total duration
Created
Input
{
"image_url": "https://replicate.delivery/pbxt/MNrfj3BHvlSnMYHJa4k53oN16kWG429appLX8N0tWQoezMmT/output.png"
}
Install Replicate’s Node.js client library:
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 fottoai/remove-bg using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"fottoai/remove-bg:81dc864ca02de47c436ed9f80f971bb21240bff430aeb27ba74916204e90ec49",
{
input: {
image_url: "https://replicate.delivery/pbxt/MNrfj3BHvlSnMYHJa4k53oN16kWG429appLX8N0tWQoezMmT/output.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.
Install Replicate’s Python client library:
pip 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 the client:
import replicate
Run fottoai/remove-bg using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"fottoai/remove-bg:81dc864ca02de47c436ed9f80f971bb21240bff430aeb27ba74916204e90ec49",
input={
"image_url": "https://replicate.delivery/pbxt/MNrfj3BHvlSnMYHJa4k53oN16kWG429appLX8N0tWQoezMmT/output.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.
Set the
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
Run fottoai/remove-bg 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": "fottoai/remove-bg:81dc864ca02de47c436ed9f80f971bb21240bff430aeb27ba74916204e90ec49",
"input": {
"image_url": "https://replicate.delivery/pbxt/MNrfj3BHvlSnMYHJa4k53oN16kWG429appLX8N0tWQoezMmT/output.png"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Output
{
"completed_at": "2025-01-25T15:58:58.496984Z",
"created_at": "2025-01-25T15:58:29.446000Z",
"data_removed": false,
"error": null,
"id": "qtkghtn28srga0cmkrqvsa2gwc",
"input": {
"image_url": "https://replicate.delivery/pbxt/MNrfj3BHvlSnMYHJa4k53oN16kWG429appLX8N0tWQoezMmT/output.png"
},
"logs": "Starting background removal...\nLoading image to process\nnormalizing image\nGenerating mask\nMask improving quality\nGenerate transparent image\nBackground removal completed.",
"metrics": {
"predict_time": 10.773847570000001,
"total_time": 29.050984
},
"output": "https://replicate.delivery/czjl/Zh9E44soqpYRGdL54Z6Q8JoPfSF7erjzTcJZlpoZN4pCxrIUA/output.png",
"started_at": "2025-01-25T15:58:47.723136Z",
"status": "succeeded",
"urls": {
"stream": "https://stream.replicate.com/v1/files/fddq-jxpvbusiephiezwlphyzpk46x4ck3y5cvus2a5ytrn4nfmzx66fa",
"get": "https://api.replicate.com/v1/predictions/qtkghtn28srga0cmkrqvsa2gwc",
"cancel": "https://api.replicate.com/v1/predictions/qtkghtn28srga0cmkrqvsa2gwc/cancel"
},
"version": "81dc864ca02de47c436ed9f80f971bb21240bff430aeb27ba74916204e90ec49"
}