typefile
{
"image": "https://replicate.delivery/pbxt/Lm1OaJ4R1SgY91F5hYMuziHGsPGadPbMH4Q2i2omGQvAmNb6/000a2d38183e668676f04f0cefe3606b.png",
"output_format": "png",
"return_zip": false
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_2wl**********************************
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 vetkastar/image-slicing using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"vetkastar/image-slicing:800ef40b9592ba76f8e0ecae5c07e976b5cf415f092d35e47e3befc9c78732f5",
{
input: {
image: "https://replicate.delivery/pbxt/Lm1OaJ4R1SgY91F5hYMuziHGsPGadPbMH4Q2i2omGQvAmNb6/000a2d38183e668676f04f0cefe3606b.png",
output_format: "png",
return_zip: false
}
}
);
// To access the file URL:
console.log(output[0].url()); //=> "http://example.com"
// To write the file to disk:
fs.writeFile("my-image.png", output[0]);
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_2wl**********************************
This is your API token. Keep it to yourself.
import replicate
Run vetkastar/image-slicing using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"vetkastar/image-slicing:800ef40b9592ba76f8e0ecae5c07e976b5cf415f092d35e47e3befc9c78732f5",
input={
"image": "https://replicate.delivery/pbxt/Lm1OaJ4R1SgY91F5hYMuziHGsPGadPbMH4Q2i2omGQvAmNb6/000a2d38183e668676f04f0cefe3606b.png",
"output_format": "png",
"return_zip": False
}
)
# To access the file URL:
print(output[0].url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output[0].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_2wl**********************************
This is your API token. Keep it to yourself.
Run vetkastar/image-slicing 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": "vetkastar/image-slicing:800ef40b9592ba76f8e0ecae5c07e976b5cf415f092d35e47e3befc9c78732f5",
"input": {
"image": "https://replicate.delivery/pbxt/Lm1OaJ4R1SgY91F5hYMuziHGsPGadPbMH4Q2i2omGQvAmNb6/000a2d38183e668676f04f0cefe3606b.png",
"output_format": "png",
"return_zip": false
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "tbbrv1wwghrge0cjf4j9fr6b50",
"model": "vetkastar/image-slicing",
"version": "800ef40b9592ba76f8e0ecae5c07e976b5cf415f092d35e47e3befc9c78732f5",
"input": {
"image": "https://replicate.delivery/pbxt/Lm1OaJ4R1SgY91F5hYMuziHGsPGadPbMH4Q2i2omGQvAmNb6/000a2d38183e668676f04f0cefe3606b.png",
"output_format": "png",
"return_zip": false
},
"logs": "",
"output": [
"https://replicate.delivery/czjl/PuMyhLQ0K94sJ5sGMIi4FzpZUIes2sJjMfEcewcov0MTxFLnA/tmpiaxghr2x000a2d38183e668676f04f0cefe3606b_1.png",
"https://replicate.delivery/czjl/szYvAL7BfWV7Hqnyz4VgvqnyjSrefIfNESsbN2G6FGTmiLWOB/tmpiaxghr2x000a2d38183e668676f04f0cefe3606b_2.png",
"https://replicate.delivery/czjl/Fc7NvEnzsnopIVhl9CAnTtQrsqyyOT3LN6cBvzzxy2aKuY5E/tmpiaxghr2x000a2d38183e668676f04f0cefe3606b_3.png",
"https://replicate.delivery/czjl/JDjimNYImfw8Cqf2P8qaFz5im3G8YKaKAbblVe9QTJBVxFLnA/tmpiaxghr2x000a2d38183e668676f04f0cefe3606b_4.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-10-11T01:14:55.492Z",
"started_at": "2024-10-11T01:15:18.563837Z",
"completed_at": "2024-10-11T01:15:22.192306Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/tbbrv1wwghrge0cjf4j9fr6b50/cancel",
"get": "https://api.replicate.com/v1/predictions/tbbrv1wwghrge0cjf4j9fr6b50",
"web": "https://replicate.com/p/tbbrv1wwghrge0cjf4j9fr6b50"
},
"metrics": {
"predict_time": 3.628468571,
"total_time": 26.700306
}
}



