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.
yyjim /segment-anything-tryout:47366ad7
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 yyjim/segment-anything-tryout using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"yyjim/segment-anything-tryout:47366ad7180cfc555213da6d180ec63433cf3f11b45bb8dabc191e8a9e6a7f41",
{
input: {
box: "[65, 0, 855, 626]",
image: "https://replicate.delivery/pbxt/Ie43tRi83xHyEQl01dPVIiz9ip5BlTVrtrS6HRdzGF1DdJWc/IMG_2205%20copy.jpg",
multimask_output: false
}
}
);
// 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 yyjim/segment-anything-tryout using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"yyjim/segment-anything-tryout:47366ad7180cfc555213da6d180ec63433cf3f11b45bb8dabc191e8a9e6a7f41",
input={
"box": "[65, 0, 855, 626]",
"image": "https://replicate.delivery/pbxt/Ie43tRi83xHyEQl01dPVIiz9ip5BlTVrtrS6HRdzGF1DdJWc/IMG_2205%20copy.jpg",
"multimask_output": 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 yyjim/segment-anything-tryout 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": "yyjim/segment-anything-tryout:47366ad7180cfc555213da6d180ec63433cf3f11b45bb8dabc191e8a9e6a7f41",
"input": {
"box": "[65, 0, 855, 626]",
"image": "https://replicate.delivery/pbxt/Ie43tRi83xHyEQl01dPVIiz9ip5BlTVrtrS6HRdzGF1DdJWc/IMG_2205%20copy.jpg",
"multimask_output": 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-04-14T00:06:43.009371Z",
"created_at": "2023-04-14T00:04:03.023767Z",
"data_removed": false,
"error": null,
"id": "qpoa7miphnf2hp7ggemewxvfya",
"input": {
"box": "[65, 0, 855, 626]",
"image": "https://replicate.delivery/pbxt/Ie43tRi83xHyEQl01dPVIiz9ip5BlTVrtrS6HRdzGF1DdJWc/IMG_2205%20copy.jpg"
},
"logs": "[0.98255014]\n(768, 1024, 4)\n[Path('mask.0.png'), Path('output.png')]",
"metrics": {
"predict_time": 4.836991,
"total_time": 159.985604
},
"output": [
"https://replicate.delivery/pbxt/1TThkJDB90oXHlBYDsQLKLBoL5U7lwLEeijOCt58MPIJWyYIA/mask.0.png",
"https://replicate.delivery/pbxt/DGu2FiCrEfTyMKffyqBhcXUnLLU6a9GjN0DTUJDirIulYJjhA/output.png"
],
"started_at": "2023-04-14T00:06:38.172380Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/qpoa7miphnf2hp7ggemewxvfya",
"cancel": "https://api.replicate.com/v1/predictions/qpoa7miphnf2hp7ggemewxvfya/cancel"
},
"version": "47366ad7180cfc555213da6d180ec63433cf3f11b45bb8dabc191e8a9e6a7f41"
}
[0.98255014]
(768, 1024, 4)
[Path('mask.0.png'), Path('output.png')]