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://st.mngbcn.com/rcs/pics/static/T5/fotos/outfit/S20/57034757_56-99999999_01.jpg",
mask_prompt: "clothes,shoes",
adjustment_factor: -15,
negative_mask_prompt: "pants"
}
}
);
// 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://st.mngbcn.com/rcs/pics/static/T5/fotos/outfit/S20/57034757_56-99999999_01.jpg",
"mask_prompt": "clothes,shoes",
"adjustment_factor": -15,
"negative_mask_prompt": "pants"
}
)
# 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://st.mngbcn.com/rcs/pics/static/T5/fotos/outfit/S20/57034757_56-99999999_01.jpg",
"mask_prompt": "clothes,shoes",
"adjustment_factor": -15,
"negative_mask_prompt": "pants"
}
}' \
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-27T20:04:43.826328Z",
"created_at": "2023-10-27T20:04:39.451477Z",
"data_removed": false,
"error": null,
"id": "cmubqstbrmnjzm4gsmvwfu4d3u",
"input": {
"image": "https://st.mngbcn.com/rcs/pics/static/T5/fotos/outfit/S20/57034757_56-99999999_01.jpg",
"mask_prompt": "clothes,shoes",
"adjustment_factor": -15,
"negative_mask_prompt": "pants"
},
"logs": "Running prediction: 5e05d41d-328d-4e22-ad68-2a09865104b4...\nDone!",
"metrics": {
"predict_time": 4.398645,
"total_time": 4.374851
},
"output": [
"https://replicate.delivery/pbxt/BQZ68Tf4k0U6Xiw6gbBNiB6PHeYNWCL9Y5YJihcPOOhZncyRA/annotated_picture_mask.jpg",
"https://replicate.delivery/pbxt/fHrUkd4rydxCGK7fQTw6gdOnf68IUNyvpM4uCKEPOIeqdyJHB/neg_annotated_picture_mask.jpg",
"https://replicate.delivery/pbxt/OK9e1dEPmI35JKh2eT58XFmntzdBDIpqRlOzvzXJlmHbncyRA/mask.jpg",
"https://replicate.delivery/pbxt/jQAawD111B4KF5nMUXVsP6xhANUoNpecRUmP5xTsylvtTO5IA/inverted_mask.jpg"
],
"started_at": "2023-10-27T20:04:39.427683Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/cmubqstbrmnjzm4gsmvwfu4d3u",
"cancel": "https://api.replicate.com/v1/predictions/cmubqstbrmnjzm4gsmvwfu4d3u/cancel"
},
"version": "ee871c19efb1941f55f66a3d7d960428c8a5afcb77449547fe8e5a3ab9ebc21c"
}
Running prediction: 5e05d41d-328d-4e22-ad68-2a09865104b4...
Done!