typefile
{
"image": "https://replicate.delivery/pbxt/KX6QL1Amx5wP1zDvjyr5QNeObbrF7TR1aHGPA6JzNoBEdVEV/cup1.png",
"input_points": "[[950,950]]"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_Ez4**********************************
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 datong-new/sam-point using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"datong-new/sam-point:a121a2ad00780aa18585c7381f012aefe4cbe25b4126125d43519358113c6124",
{
input: {
image: "https://replicate.delivery/pbxt/KX6QL1Amx5wP1zDvjyr5QNeObbrF7TR1aHGPA6JzNoBEdVEV/cup1.png",
input_points: "[[950,950]]"
}
}
);
// 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_Ez4**********************************
This is your API token. Keep it to yourself.
import replicate
Run datong-new/sam-point using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"datong-new/sam-point:a121a2ad00780aa18585c7381f012aefe4cbe25b4126125d43519358113c6124",
input={
"image": "https://replicate.delivery/pbxt/KX6QL1Amx5wP1zDvjyr5QNeObbrF7TR1aHGPA6JzNoBEdVEV/cup1.png",
"input_points": "[[950,950]]"
}
)
# 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_Ez4**********************************
This is your API token. Keep it to yourself.
Run datong-new/sam-point 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": "datong-new/sam-point:a121a2ad00780aa18585c7381f012aefe4cbe25b4126125d43519358113c6124",
"input": {
"image": "https://replicate.delivery/pbxt/KX6QL1Amx5wP1zDvjyr5QNeObbrF7TR1aHGPA6JzNoBEdVEV/cup1.png",
"input_points": "[[950,950]]"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "pddszgzcppao5r4zxerxjuyj4e",
"model": "datong-new/sam-point",
"version": "a121a2ad00780aa18585c7381f012aefe4cbe25b4126125d43519358113c6124",
"input": {
"image": "https://replicate.delivery/pbxt/KX6QL1Amx5wP1zDvjyr5QNeObbrF7TR1aHGPA6JzNoBEdVEV/cup1.png",
"input_points": "[[950,950]]"
},
"logs": "",
"output": [
"https://replicate.delivery/pbxt/Q6rfhpmZiWThdCkn3EOGaKeP6fZd2gITVZt798RpeZWGhfwTC/mask1.png",
"https://replicate.delivery/pbxt/a8rWvS0NYmZQBVHRLnPxMDAfLeXw4JH9WPKytsSbIgJR4HekA/img1.png",
"https://replicate.delivery/pbxt/e2vEU8yfdMls9kuU1ekfbwTIR1FnsqQUyaCzMZ9gNVnEhfwTC/mask2.png",
"https://replicate.delivery/pbxt/FUlKuj81VCa5OZnlYa86GMgfjzaf2blf3UDuyUeHth5FhfwTC/img2.png"
],
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2024-03-08T08:27:44.098451Z",
"started_at": "2024-03-08T08:27:57.75781Z",
"completed_at": "2024-03-08T08:28:02.006753Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/pddszgzcppao5r4zxerxjuyj4e/cancel",
"get": "https://api.replicate.com/v1/predictions/pddszgzcppao5r4zxerxjuyj4e"
},
"metrics": {
"predict_time": 4.248943,
"total_time": 17.908302
}
}



