default./shape-smoothing-original-image.png
typefile
{
"cutoff": 0.001,
"input_image": "https://replicate.delivery/mgxm/3aa3f264-6539-4e18-8a55-c8b5f982327a/contour.png"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_XnJ**********************************
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 ariel415el/simplify_contours using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"ariel415el/simplify_contours:a316fb81d5b721b99dc8e5041b0c9e19073d8f988d1bb62bf6a3a5d4157b12d7",
{
input: {
cutoff: 0.001,
input_image: "https://replicate.delivery/mgxm/3aa3f264-6539-4e18-8a55-c8b5f982327a/contour.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_XnJ**********************************
This is your API token. Keep it to yourself.
import replicate
Run ariel415el/simplify_contours using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"ariel415el/simplify_contours:a316fb81d5b721b99dc8e5041b0c9e19073d8f988d1bb62bf6a3a5d4157b12d7",
input={
"cutoff": 0.001,
"input_image": "https://replicate.delivery/mgxm/3aa3f264-6539-4e18-8a55-c8b5f982327a/contour.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_XnJ**********************************
This is your API token. Keep it to yourself.
Run ariel415el/simplify_contours 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": "ariel415el/simplify_contours:a316fb81d5b721b99dc8e5041b0c9e19073d8f988d1bb62bf6a3a5d4157b12d7",
"input": {
"cutoff": 0.001,
"input_image": "https://replicate.delivery/mgxm/3aa3f264-6539-4e18-8a55-c8b5f982327a/contour.png"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "s752zqg3wzgcdbwvsminidakhq",
"model": "ariel415el/simplify_contours",
"version": "a316fb81d5b721b99dc8e5041b0c9e19073d8f988d1bb62bf6a3a5d4157b12d7",
"input": {
"cutoff": 0.001,
"input_image": "https://replicate.delivery/mgxm/3aa3f264-6539-4e18-8a55-c8b5f982327a/contour.png"
},
"logs": "",
"output": "https://replicate.delivery/mgxm/15f89647-02fe-427a-a71b-fabb494e4ce1/output.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2022-04-21T10:18:18.887208Z",
"started_at": "2022-04-21T10:18:43.618794Z",
"completed_at": "2022-04-21T10:18:43.618797Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/s752zqg3wzgcdbwvsminidakhq/cancel",
"get": "https://api.replicate.com/v1/predictions/s752zqg3wzgcdbwvsminidakhq"
},
"metrics": {
"predict_time": 0.000003,
"total_time": 24.731589
}
}
