{
"image": "https://replicate.delivery/pbxt/IeDgvgehYgR4YpUT8SqRjP7qLisjjKbJ0MsAUaHII5FhHpVN/a.jpg",
"output_json": true
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_bnP**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run cjwbw/semantic-segment-anything using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"cjwbw/semantic-segment-anything:b2691db53f2d96add0051a4a98e7a3861bd21bf5972031119d344d956d2f8256",
{
input: {
image: "https://replicate.delivery/pbxt/IeDgvgehYgR4YpUT8SqRjP7qLisjjKbJ0MsAUaHII5FhHpVN/a.jpg",
output_json: true
}
}
);
console.log(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_bnP**********************************
This is your API token. Keep it to yourself.
import replicate
Run cjwbw/semantic-segment-anything using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"cjwbw/semantic-segment-anything:b2691db53f2d96add0051a4a98e7a3861bd21bf5972031119d344d956d2f8256",
input={
"image": "https://replicate.delivery/pbxt/IeDgvgehYgR4YpUT8SqRjP7qLisjjKbJ0MsAUaHII5FhHpVN/a.jpg",
"output_json": True
}
)
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=r8_bnP**********************************
This is your API token. Keep it to yourself.
Run cjwbw/semantic-segment-anything 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": "cjwbw/semantic-segment-anything:b2691db53f2d96add0051a4a98e7a3861bd21bf5972031119d344d956d2f8256",
"input": {
"image": "https://replicate.delivery/pbxt/IeDgvgehYgR4YpUT8SqRjP7qLisjjKbJ0MsAUaHII5FhHpVN/a.jpg",
"output_json": true
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
Object output with 2 properties
{
"id": "smqylmbmsraihdta56g2uejoze",
"model": "cjwbw/semantic-segment-anything",
"version": "b2691db53f2d96add0051a4a98e7a3861bd21bf5972031119d344d956d2f8256",
"input": {
"image": "https://replicate.delivery/pbxt/IeDgvgehYgR4YpUT8SqRjP7qLisjjKbJ0MsAUaHII5FhHpVN/a.jpg",
"output_json": true
},
"logs": "/root/.pyenv/versions/3.8.16/lib/python3.8/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3190.)\nreturn _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]\n/root/.pyenv/versions/3.8.16/lib/python3.8/site-packages/transformers/generation/utils.py:1288: UserWarning: Using `max_length`'s default (20) to control the generation length. This behaviour is deprecated and will be removed from the config in v5 of Transformers -- we recommend using `max_new_tokens` to control the maximum length of the generation.\nwarnings.warn(",
"output": {
"img_out": "https://replicate.delivery/pbxt/zttLZCfyXp1aDqS5Gd1OeDuiaPGnN722jFio5hNeXyUSeXGDB/seg_out.png",
"json_out": "https://replicate.delivery/pbxt/ZNh6er6mvwWfNUSZWdfStS9lTfQl1PnCGkk6QI9zvJWm8XGDB/seg_out.json"
},
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-04-14T01:33:03.29544Z",
"started_at": "2023-04-14T01:34:19.538723Z",
"completed_at": "2023-04-14T01:35:06.37718Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/smqylmbmsraihdta56g2uejoze/cancel",
"get": "https://api.replicate.com/v1/predictions/smqylmbmsraihdta56g2uejoze"
},
"metrics": {
"predict_time": 46.838457,
"total_time": 123.08174
}
}
