typefile
{
"image": "https://raw.githubusercontent.com/Wzesk/littoral_segment/45c82d810a1d3a85456b9ac6fb23d8de70829884/input.png"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_B96**********************************
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 wzesk/littoral_segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"wzesk/littoral_segment:1211330f2b12248624b1c3e014c5a53a51ae5ed25d6ba7fff8eb4a4720580813",
{
input: {
image: "https://raw.githubusercontent.com/Wzesk/littoral_segment/45c82d810a1d3a85456b9ac6fb23d8de70829884/input.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_B96**********************************
This is your API token. Keep it to yourself.
import replicate
Run wzesk/littoral_segment using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"wzesk/littoral_segment:1211330f2b12248624b1c3e014c5a53a51ae5ed25d6ba7fff8eb4a4720580813",
input={
"image": "https://raw.githubusercontent.com/Wzesk/littoral_segment/45c82d810a1d3a85456b9ac6fb23d8de70829884/input.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_B96**********************************
This is your API token. Keep it to yourself.
Run wzesk/littoral_segment 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": "wzesk/littoral_segment:1211330f2b12248624b1c3e014c5a53a51ae5ed25d6ba7fff8eb4a4720580813",
"input": {
"image": "https://raw.githubusercontent.com/Wzesk/littoral_segment/45c82d810a1d3a85456b9ac6fb23d8de70829884/input.png"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "7ren7cpsnxrj60cmeq7vkvngbm",
"model": "wzesk/littoral_segment",
"version": "1211330f2b12248624b1c3e014c5a53a51ae5ed25d6ba7fff8eb4a4720580813",
"input": {
"image": "https://raw.githubusercontent.com/Wzesk/littoral_segment/45c82d810a1d3a85456b9ac6fb23d8de70829884/input.png"
},
"logs": "0: 640x608 1 island, 106.5ms\nSpeed: 6.3ms preprocess, 106.5ms inference, 343.2ms postprocess per image at shape (1, 3, 640, 608)",
"output": "https://replicate.delivery/yhqm/hlDUp9mKgELVCxRVD0qnBr23whkcIhblxCerzKHMeHLqZGGUA/mask.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2025-01-17T19:49:03.535Z",
"started_at": "2025-01-17T19:50:00.806443Z",
"completed_at": "2025-01-17T19:50:02.88742Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/7ren7cpsnxrj60cmeq7vkvngbm/cancel",
"get": "https://api.replicate.com/v1/predictions/7ren7cpsnxrj60cmeq7vkvngbm",
"stream": "https://stream.replicate.com/v1/files/qoxq-i47ukx6xmpeg2ly7w324becs5ko4awbqblxtb5nnlwaulc5fz6na",
"web": "https://replicate.com/p/7ren7cpsnxrj60cmeq7vkvngbm"
},
"metrics": {
"predict_time": 2.08097797,
"total_time": 59.35242
}
}
