typefile
{
"image": "https://replicate.delivery/pbxt/MK89YZGY5050parhZUeSPLGncmiMk2AuQ6LNAygeh95Aw7vi/u6363347132_an_orc_heavily_armored_using_a_mace_and_shield_in_76f1e963-b17b-4fa1-ac23-93f53d8a41ef_3.png"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_IHm**********************************
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 lightweight-ai/test_bgrem using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"lightweight-ai/test_bgrem:92a9a78104861948211c7ace8dd671a424d712c0a8e335937262ad49df5b1f76",
{
input: {
image: "https://replicate.delivery/pbxt/MK89YZGY5050parhZUeSPLGncmiMk2AuQ6LNAygeh95Aw7vi/u6363347132_an_orc_heavily_armored_using_a_mace_and_shield_in_76f1e963-b17b-4fa1-ac23-93f53d8a41ef_3.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_IHm**********************************
This is your API token. Keep it to yourself.
import replicate
Run lightweight-ai/test_bgrem using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"lightweight-ai/test_bgrem:92a9a78104861948211c7ace8dd671a424d712c0a8e335937262ad49df5b1f76",
input={
"image": "https://replicate.delivery/pbxt/MK89YZGY5050parhZUeSPLGncmiMk2AuQ6LNAygeh95Aw7vi/u6363347132_an_orc_heavily_armored_using_a_mace_and_shield_in_76f1e963-b17b-4fa1-ac23-93f53d8a41ef_3.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_IHm**********************************
This is your API token. Keep it to yourself.
Run lightweight-ai/test_bgrem 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": "lightweight-ai/test_bgrem:92a9a78104861948211c7ace8dd671a424d712c0a8e335937262ad49df5b1f76",
"input": {
"image": "https://replicate.delivery/pbxt/MK89YZGY5050parhZUeSPLGncmiMk2AuQ6LNAygeh95Aw7vi/u6363347132_an_orc_heavily_armored_using_a_mace_and_shield_in_76f1e963-b17b-4fa1-ac23-93f53d8a41ef_3.png"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "4g23j1twgnrmc0cmd01ag4jydr",
"model": "lightweight-ai/test_bgrem",
"version": "92a9a78104861948211c7ace8dd671a424d712c0a8e335937262ad49df5b1f76",
"input": {
"image": "https://replicate.delivery/pbxt/MK89YZGY5050parhZUeSPLGncmiMk2AuQ6LNAygeh95Aw7vi/u6363347132_an_orc_heavily_armored_using_a_mace_and_shield_in_76f1e963-b17b-4fa1-ac23-93f53d8a41ef_3.png"
},
"logs": "",
"output": "https://replicate.delivery/xezq/pGsieZwDNHUSaiA6MBzdZgPyBrfkHfDEPfvkSPy4tGEBc3UQB/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-01-15T03:29:32.805Z",
"started_at": "2025-01-15T03:30:03.997194Z",
"completed_at": "2025-01-15T03:30:08.731274Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/4g23j1twgnrmc0cmd01ag4jydr/cancel",
"get": "https://api.replicate.com/v1/predictions/4g23j1twgnrmc0cmd01ag4jydr",
"stream": "https://stream.replicate.com/v1/files/bcwr-kjjh7inlv64vnkdfpy4iizth3oduvck6iip2d7varwpktf3zns6q",
"web": "https://replicate.com/p/4g23j1twgnrmc0cmd01ag4jydr"
},
"metrics": {
"predict_time": 4.734080652,
"total_time": 35.926274
}
}
