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.
tmappdev /lang-segment-anything:891411c3
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 tmappdev/lang-segment-anything using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"tmappdev/lang-segment-anything:891411c38a6ed2d44c004b7b9e44217df7a5b07848f29ddefd2e28bc7cbf93bc",
{
input: {
image: "https://replicate.delivery/pbxt/M2tUXKe06UEAExSwWbcYvMOoGVXGtEbvsD52HaSgC3vulSfR/a2ed4.jpg",
text_prompt: "text,watermark"
}
}
);
// 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 tmappdev/lang-segment-anything using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"tmappdev/lang-segment-anything:891411c38a6ed2d44c004b7b9e44217df7a5b07848f29ddefd2e28bc7cbf93bc",
input={
"image": "https://replicate.delivery/pbxt/M2tUXKe06UEAExSwWbcYvMOoGVXGtEbvsD52HaSgC3vulSfR/a2ed4.jpg",
"text_prompt": "text,watermark"
}
)
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 tmappdev/lang-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": "891411c38a6ed2d44c004b7b9e44217df7a5b07848f29ddefd2e28bc7cbf93bc",
"input": {
"image": "https://replicate.delivery/pbxt/M2tUXKe06UEAExSwWbcYvMOoGVXGtEbvsD52HaSgC3vulSfR/a2ed4.jpg",
"text_prompt": "text,watermark"
}
}' \
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": "2024-11-27T14:04:41.235331Z",
"created_at": "2024-11-27T14:03:58.647000Z",
"data_removed": false,
"error": null,
"id": "a6qx184q6xrj20ckdqqvgy8cfw",
"input": {
"image": "https://replicate.delivery/pbxt/M2tUXKe06UEAExSwWbcYvMOoGVXGtEbvsD52HaSgC3vulSfR/a2ed4.jpg",
"text_prompt": "text,watermark"
},
"logs": "Predicting 1 masks\n/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torchvision/transforms/functional.py:154: UserWarning: The given NumPy array is not writable, and PyTorch does not support non-writable tensors. This means writing to this tensor will result in undefined behavior. You may want to copy the array to protect its data or make it writable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:206.)\nimg = torch.from_numpy(pic.transpose((2, 0, 1))).contiguous()\nPredicted 1 masks",
"metrics": {
"predict_time": 2.236687529,
"total_time": 42.588331
},
"output": "https://replicate.delivery/yhqm/Q2pSoJaTgtbrE5kw9tKgC9SNEWAkFs5kS408pHxVjjYexm6JA/mask_output.png",
"started_at": "2024-11-27T14:04:38.998644Z",
"status": "succeeded",
"urls": {
"stream": "https://stream.replicate.com/v1/files/qoxq-zxcnlujdk4zojpplprkb5yedrl7ihsxkowue5rbvppggyqhipjqa",
"get": "https://api.replicate.com/v1/predictions/a6qx184q6xrj20ckdqqvgy8cfw",
"cancel": "https://api.replicate.com/v1/predictions/a6qx184q6xrj20ckdqqvgy8cfw/cancel"
},
"version": "891411c38a6ed2d44c004b7b9e44217df7a5b07848f29ddefd2e28bc7cbf93bc"
}
Predicting 1 masks
/root/.pyenv/versions/3.11.10/lib/python3.11/site-packages/torchvision/transforms/functional.py:154: UserWarning: The given NumPy array is not writable, and PyTorch does not support non-writable tensors. This means writing to this tensor will result in undefined behavior. You may want to copy the array to protect its data or make it writable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:206.)
img = torch.from_numpy(pic.transpose((2, 0, 1))).contiguous()
Predicted 1 masks