typefile
{
"box_nms_thresh": 0.7,
"crop_n_points_downscale_factor": 1,
"crop_nms_thresh": 0.7,
"crop_overlap_ratio": 0.3413333333333333,
"image": "https://replicate.delivery/pbxt/IbLtTz5PFfyk5W9GZCCKXyiyldxQyRGhmLlGo4zdCf2snIbW/chameleon.jpg",
"min_mask_region_area": 30,
"points_per_side": 32,
"pred_iou_thresh": 0.88,
"resize_width": 1080,
"stability_score_offset": 1,
"stability_score_thresh": 0.95
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_GcU**********************************
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 pablodawson/segment-anything-automatic using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"pablodawson/segment-anything-automatic:14fbb04535964b3d0c7fad03bb4ed272130f15b956cbedb7b2f20b5b8a2dbaa0",
{
input: {
box_nms_thresh: 0.7,
crop_n_points_downscale_factor: 1,
crop_nms_thresh: 0.7,
crop_overlap_ratio: 0.3413333333333333,
image: "https://replicate.delivery/pbxt/IbLtTz5PFfyk5W9GZCCKXyiyldxQyRGhmLlGo4zdCf2snIbW/chameleon.jpg",
min_mask_region_area: 30,
points_per_side: 32,
pred_iou_thresh: 0.88,
resize_width: 1080,
stability_score_offset: 1,
stability_score_thresh: 0.95
}
}
);
// 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_GcU**********************************
This is your API token. Keep it to yourself.
import replicate
Run pablodawson/segment-anything-automatic using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"pablodawson/segment-anything-automatic:14fbb04535964b3d0c7fad03bb4ed272130f15b956cbedb7b2f20b5b8a2dbaa0",
input={
"box_nms_thresh": 0.7,
"crop_n_points_downscale_factor": 1,
"crop_nms_thresh": 0.7,
"crop_overlap_ratio": 0.3413333333333333,
"image": "https://replicate.delivery/pbxt/IbLtTz5PFfyk5W9GZCCKXyiyldxQyRGhmLlGo4zdCf2snIbW/chameleon.jpg",
"min_mask_region_area": 30,
"points_per_side": 32,
"pred_iou_thresh": 0.88,
"resize_width": 1080,
"stability_score_offset": 1,
"stability_score_thresh": 0.95
}
)
# 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_GcU**********************************
This is your API token. Keep it to yourself.
Run pablodawson/segment-anything-automatic 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": "pablodawson/segment-anything-automatic:14fbb04535964b3d0c7fad03bb4ed272130f15b956cbedb7b2f20b5b8a2dbaa0",
"input": {
"box_nms_thresh": 0.7,
"crop_n_points_downscale_factor": 1,
"crop_nms_thresh": 0.7,
"crop_overlap_ratio": 0.3413333333333333,
"image": "https://replicate.delivery/pbxt/IbLtTz5PFfyk5W9GZCCKXyiyldxQyRGhmLlGo4zdCf2snIbW/chameleon.jpg",
"min_mask_region_area": 30,
"points_per_side": 32,
"pred_iou_thresh": 0.88,
"resize_width": 1080,
"stability_score_offset": 1,
"stability_score_thresh": 0.95
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "ganxztf36fh45nnkpuobcjm24y",
"model": "pablodawson/segment-anything-automatic",
"version": "14fbb04535964b3d0c7fad03bb4ed272130f15b956cbedb7b2f20b5b8a2dbaa0",
"input": {
"box_nms_thresh": 0.7,
"crop_n_points_downscale_factor": 1,
"crop_nms_thresh": 0.7,
"crop_overlap_ratio": 0.3413333333333333,
"image": "https://replicate.delivery/pbxt/IbLtTz5PFfyk5W9GZCCKXyiyldxQyRGhmLlGo4zdCf2snIbW/chameleon.jpg",
"min_mask_region_area": 30,
"points_per_side": 32,
"pred_iou_thresh": 0.88,
"resize_width": 1080,
"stability_score_offset": 1,
"stability_score_thresh": 0.95
},
"logs": "",
"output": "https://replicate.delivery/pbxt/bkFZp29eyu2hcKsuv0kebWutvn1eLE1ZKeWecf2MYfTWXxdXIA/output_mask.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-04-05T23:39:16.277425Z",
"started_at": "2023-04-05T23:39:16.409283Z",
"completed_at": "2023-04-05T23:39:26.937367Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/ganxztf36fh45nnkpuobcjm24y/cancel",
"get": "https://api.replicate.com/v1/predictions/ganxztf36fh45nnkpuobcjm24y"
},
"metrics": {
"predict_time": 10.528084,
"total_time": 10.659942
}
}
