Failed to load versions. Head to the versions page to see all versions for this model.
You're looking at a specific version of this model. Jump to the model overview.
leandroamaral /segmentanything:8a1fbd7f
Input
Run this model in Node.js with one line of code:
npm install replicate
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run leandroamaral/segmentanything using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"leandroamaral/segmentanything:8a1fbd7f4fd3d059078293f5e40ef07d879b5930425070310be8f2c4071ca9cc",
{
input: {
iou: 0.7,
conf: 0.25,
image: "https://replicate.delivery/pbxt/K4E8TaybuiJvMtKVh5sB0suw44if4fbxktQDr1012kakXp6c/6121el8NPZL._AC_SX569_%20%281%29.jpg",
retina: true,
box_prompt: "[0,0,0,0]",
model_name: "FastSAM-x",
point_label: "[1]",
point_prompt: "[[200,200]]",
withContours: false,
better_quality: false
}
}
);
// 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=<paste-your-token-here>
Find your API token in your account settings.
import replicate
Run leandroamaral/segmentanything using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"leandroamaral/segmentanything:8a1fbd7f4fd3d059078293f5e40ef07d879b5930425070310be8f2c4071ca9cc",
input={
"iou": 0.7,
"conf": 0.25,
"image": "https://replicate.delivery/pbxt/K4E8TaybuiJvMtKVh5sB0suw44if4fbxktQDr1012kakXp6c/6121el8NPZL._AC_SX569_%20%281%29.jpg",
"retina": True,
"box_prompt": "[0,0,0,0]",
"model_name": "FastSAM-x",
"point_label": "[1]",
"point_prompt": "[[200,200]]",
"withContours": False,
"better_quality": False
}
)
print(output)
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN
environment variable:export REPLICATE_API_TOKEN=<paste-your-token-here>
Find your API token in your account settings.
Run leandroamaral/segmentanything 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": "leandroamaral/segmentanything:8a1fbd7f4fd3d059078293f5e40ef07d879b5930425070310be8f2c4071ca9cc",
"input": {
"iou": 0.7,
"conf": 0.25,
"image": "https://replicate.delivery/pbxt/K4E8TaybuiJvMtKVh5sB0suw44if4fbxktQDr1012kakXp6c/6121el8NPZL._AC_SX569_%20%281%29.jpg",
"retina": true,
"box_prompt": "[0,0,0,0]",
"model_name": "FastSAM-x",
"point_label": "[1]",
"point_prompt": "[[200,200]]",
"withContours": false,
"better_quality": false
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Add a payment method to run this model.
By signing in, you agree to our
terms of service and privacy policy
Output
{
"completed_at": "2023-12-18T00:03:47.997658Z",
"created_at": "2023-12-18T00:03:47.148591Z",
"data_removed": false,
"error": null,
"id": "ksrpgjbcsdeguyhbtz6e7bidze",
"input": {
"iou": 0.7,
"conf": 0.25,
"image": "https://replicate.delivery/pbxt/K4E8TaybuiJvMtKVh5sB0suw44if4fbxktQDr1012kakXp6c/6121el8NPZL._AC_SX569_%20%281%29.jpg",
"retina": true,
"box_prompt": "[0,0,0,0]",
"model_name": "FastSAM-x",
"point_label": "[1]",
"point_prompt": "[[200,200]]",
"withContours": false,
"better_quality": false
},
"logs": "image 1/1 /tmp/tmpx2lnaunb6121el8NPZL._AC_SX569_ (1).jpg: 1024x1024 23 objects, 257.2ms\nSpeed: 8.4ms preprocess, 257.2ms inference, 9.4ms postprocess per image at shape (1, 3, 1024, 1024)",
"metrics": {
"predict_time": 0.829524,
"total_time": 0.849067
},
"output": "https://replicate.delivery/pbxt/l8ChJQlfdfpElkkne963ynCVHezMfbDzTvDO1PemYaO4YepBJA/tmp.out.png",
"started_at": "2023-12-18T00:03:47.168134Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/ksrpgjbcsdeguyhbtz6e7bidze",
"cancel": "https://api.replicate.com/v1/predictions/ksrpgjbcsdeguyhbtz6e7bidze/cancel"
},
"version": "8a1fbd7f4fd3d059078293f5e40ef07d879b5930425070310be8f2c4071ca9cc"
}
image 1/1 /tmp/tmpx2lnaunb6121el8NPZL._AC_SX569_ (1).jpg: 1024x1024 23 objects, 257.2ms
Speed: 8.4ms preprocess, 257.2ms inference, 9.4ms postprocess per image at shape (1, 3, 1024, 1024)