typefile
{
"image": "https://replicate.delivery/pbxt/JbjufeSNgnhd4kSJby2lEsvuEiJRnpUPcXCYFafCB1hIWT7k/08113317_20220311_DX_1_1_1-redacted_dot_app.jpg"
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_VZe**********************************
This is your API token. Keep it to yourself.
import Replicate from "replicate";
import fs from "node:fs";
const replicate = new Replicate({
auth: process.env.REPLICATE_API_TOKEN,
});
Run medicapture/seg-model using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"medicapture/seg-model:d51c0e7cb948983e4f1a74c1a0467e0a6805e797fb2e4055eabba2cca4b71a6b",
{
input: {
image: "https://replicate.delivery/pbxt/JbjufeSNgnhd4kSJby2lEsvuEiJRnpUPcXCYFafCB1hIWT7k/08113317_20220311_DX_1_1_1-redacted_dot_app.jpg"
}
}
);
// 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=r8_VZe**********************************
This is your API token. Keep it to yourself.
import replicate
Run medicapture/seg-model using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"medicapture/seg-model:d51c0e7cb948983e4f1a74c1a0467e0a6805e797fb2e4055eabba2cca4b71a6b",
input={
"image": "https://replicate.delivery/pbxt/JbjufeSNgnhd4kSJby2lEsvuEiJRnpUPcXCYFafCB1hIWT7k/08113317_20220311_DX_1_1_1-redacted_dot_app.jpg"
}
)
# To access the file URL:
print(output.url())
#=> "http://example.com"
# To write the file to disk:
with open("my-image.png", "wb") as file:
file.write(output.read())
To learn more, take a look at the guide on getting started with Python.
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_VZe**********************************
This is your API token. Keep it to yourself.
Run medicapture/seg-model 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": "medicapture/seg-model:d51c0e7cb948983e4f1a74c1a0467e0a6805e797fb2e4055eabba2cca4b71a6b",
"input": {
"image": "https://replicate.delivery/pbxt/JbjufeSNgnhd4kSJby2lEsvuEiJRnpUPcXCYFafCB1hIWT7k/08113317_20220311_DX_1_1_1-redacted_dot_app.jpg"
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "ikgmxszbt6colz2v7dgnj7f5du",
"model": "medicapture/seg-model",
"version": "d51c0e7cb948983e4f1a74c1a0467e0a6805e797fb2e4055eabba2cca4b71a6b",
"input": {
"image": "https://replicate.delivery/pbxt/JbjufeSNgnhd4kSJby2lEsvuEiJRnpUPcXCYFafCB1hIWT7k/08113317_20220311_DX_1_1_1-redacted_dot_app.jpg"
},
"logs": "/root/.pyenv/versions/3.10.13/lib/python3.10/site-packages/torchvision/transforms/functional.py:1603: UserWarning: The default value of the antialias parameter of all the resizing transforms (Resize(), RandomResizedCrop(), etc.) will change from None to True in v0.17, in order to be consistent across the PIL and Tensor backends. To suppress this warning, directly pass antialias=True (recommended, future default), antialias=None (current default, which means False for Tensors and True for PIL), or antialias=False (only works on Tensors - PIL will still use antialiasing). This also applies if you are using the inference transforms from the models weights: update the call to weights.transforms(antialias=True).\nwarnings.warn(\nend of inference",
"output": "https://pbxt.replicate.delivery/4mfwP5H77gxoMSAc40UAKlEkffwfGfuc5N81lgHqtKNHE4GNC/seg.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-09-28T17:54:49.102247Z",
"started_at": "2023-09-28T17:55:42.61628Z",
"completed_at": "2023-09-28T17:55:44.372864Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/ikgmxszbt6colz2v7dgnj7f5du/cancel",
"get": "https://api.replicate.com/v1/predictions/ikgmxszbt6colz2v7dgnj7f5du"
},
"metrics": {
"predict_time": 1.756584,
"total_time": 55.270617
}
}
