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.
schananas /grounded_sam:ee871c19
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";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run schananas/grounded_sam using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"schananas/grounded_sam:ee871c19efb1941f55f66a3d7d960428c8a5afcb77449547fe8e5a3ab9ebc21c",
{
input: {
image: "https://replicate.delivery/pbxt/JmHO96vCx2ytZlD0NcrOV34qH2hJgjf9XEUXgpj6xdFZgVQp/IMG_20231023_084258.jpg",
mask_prompt: "Car",
adjustment_factor: -25,
negative_mask_prompt: "Wheels"
}
}
);
// 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=<paste-your-token-here>
Find your API token in your account settings.
import replicate
Run schananas/grounded_sam using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"schananas/grounded_sam:ee871c19efb1941f55f66a3d7d960428c8a5afcb77449547fe8e5a3ab9ebc21c",
input={
"image": "https://replicate.delivery/pbxt/JmHO96vCx2ytZlD0NcrOV34qH2hJgjf9XEUXgpj6xdFZgVQp/IMG_20231023_084258.jpg",
"mask_prompt": "Car",
"adjustment_factor": -25,
"negative_mask_prompt": "Wheels"
}
)
# The schananas/grounded_sam model can stream output as it's running.
# The predict method returns an iterator, and you can iterate over that output.
for item in output:
# https://replicate.com/schananas/grounded_sam/api#output-schema
print(item)
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 schananas/grounded_sam 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": "schananas/grounded_sam:ee871c19efb1941f55f66a3d7d960428c8a5afcb77449547fe8e5a3ab9ebc21c",
"input": {
"image": "https://replicate.delivery/pbxt/JmHO96vCx2ytZlD0NcrOV34qH2hJgjf9XEUXgpj6xdFZgVQp/IMG_20231023_084258.jpg",
"mask_prompt": "Car",
"adjustment_factor": -25,
"negative_mask_prompt": "Wheels"
}
}' \
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-10-28T10:33:42.325297Z",
"created_at": "2023-10-28T10:33:35.335124Z",
"data_removed": false,
"error": null,
"id": "35arpudb2pohpxjymhxkev2y3m",
"input": {
"image": "https://replicate.delivery/pbxt/JmHO96vCx2ytZlD0NcrOV34qH2hJgjf9XEUXgpj6xdFZgVQp/IMG_20231023_084258.jpg",
"mask_prompt": "Car",
"adjustment_factor": -25,
"negative_mask_prompt": "Wheels"
},
"logs": "Running prediction: 102cd81a-5aef-4f1b-b4e9-0604b8bf5db1...\nDone!",
"metrics": {
"predict_time": 7.017146,
"total_time": 6.990173
},
"output": [
"https://replicate.delivery/pbxt/I3ABvw1A6dqQLRnrv1wBeaerJBvWluoHVrxyNgd9By3DWpyRA/annotated_picture_mask.jpg",
"https://replicate.delivery/pbxt/IDzup7EeYGUAVCx2ZrSGUFdaR1WxYT4YcunOWpeT7Z2EWpyRA/neg_annotated_picture_mask.jpg",
"https://replicate.delivery/pbxt/vz1K5IepIcxrSySEGev2Y1WjMXUubPZbiQJeuR9iFl0KsSljA/mask.jpg",
"https://replicate.delivery/pbxt/8yIE2Vfp2tTCHSXfvIWx0I1M9kF6DHPW7McILHzpBA5GWpyRA/inverted_mask.jpg"
],
"started_at": "2023-10-28T10:33:35.308151Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/35arpudb2pohpxjymhxkev2y3m",
"cancel": "https://api.replicate.com/v1/predictions/35arpudb2pohpxjymhxkev2y3m/cancel"
},
"version": "ee871c19efb1941f55f66a3d7d960428c8a5afcb77449547fe8e5a3ab9ebc21c"
}
Running prediction: 102cd81a-5aef-4f1b-b4e9-0604b8bf5db1...
Done!