typefile
{
"image": "https://replicate.delivery/pbxt/JV6Hf1o3UjfjXbBXVEBnsSehCpM4Jc3foqx7HQRHXExB2pdj/screenshot-20230910-083933.png",
"imgsz": 1280,
"iou": 0.45,
"show_conf": true,
"show_text": true,
"threshold": 0.6
}npm install replicate
REPLICATE_API_TOKEN environment variable:export REPLICATE_API_TOKEN=r8_YLh**********************************
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 hilongjw/sec_detect using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"hilongjw/sec_detect:624142fab1995881995e5d0502e669436c3f0266076f74ffda25929a8aca2dc3",
{
input: {
image: "https://replicate.delivery/pbxt/JV6Hf1o3UjfjXbBXVEBnsSehCpM4Jc3foqx7HQRHXExB2pdj/screenshot-20230910-083933.png",
imgsz: 1280,
iou: 0.45,
show_conf: true,
show_text: true,
threshold: 0.6
}
}
);
// 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_YLh**********************************
This is your API token. Keep it to yourself.
import replicate
Run hilongjw/sec_detect using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"hilongjw/sec_detect:624142fab1995881995e5d0502e669436c3f0266076f74ffda25929a8aca2dc3",
input={
"image": "https://replicate.delivery/pbxt/JV6Hf1o3UjfjXbBXVEBnsSehCpM4Jc3foqx7HQRHXExB2pdj/screenshot-20230910-083933.png",
"imgsz": 1280,
"iou": 0.45,
"show_conf": True,
"show_text": True,
"threshold": 0.6
}
)
# 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_YLh**********************************
This is your API token. Keep it to yourself.
Run hilongjw/sec_detect 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": "hilongjw/sec_detect:624142fab1995881995e5d0502e669436c3f0266076f74ffda25929a8aca2dc3",
"input": {
"image": "https://replicate.delivery/pbxt/JV6Hf1o3UjfjXbBXVEBnsSehCpM4Jc3foqx7HQRHXExB2pdj/screenshot-20230910-083933.png",
"imgsz": 1280,
"iou": 0.45,
"show_conf": true,
"show_text": true,
"threshold": 0.6
}
}' \
https://api.replicate.com/v1/predictions
To learn more, take a look at Replicate’s HTTP API reference docs.
{
"id": "ne7xpebbqyyy6zosucw5ygai7a",
"model": "hilongjw/sec_detect",
"version": "624142fab1995881995e5d0502e669436c3f0266076f74ffda25929a8aca2dc3",
"input": {
"image": "https://replicate.delivery/pbxt/JV6Hf1o3UjfjXbBXVEBnsSehCpM4Jc3foqx7HQRHXExB2pdj/screenshot-20230910-083933.png",
"imgsz": 1280,
"iou": 0.45,
"show_conf": true,
"show_text": true,
"threshold": 0.6
},
"logs": "image /tmp/tmpolktnjo4screenshot-20230910-083933.png\nimg_path /tmp/tmpolktnjo4screenshot-20230910-083933.png\n0: 640x640 Section 0.71, SectionGradient 0.21, SectionImage 0.08, 63.6ms\nSpeed: 8.0ms preprocess, 63.6ms inference, 0.3ms postprocess per image at shape (1, 3, 640, 640)",
"output": "https://replicate.delivery/pbxt/xCAJS4fJA1UADKRg4eG7Vv9wWwmOTLMqCzF02elfVvw7zxKGB/output_tmpolktnjo4screenshot-20230910-083933.png",
"data_removed": false,
"error": null,
"source": "web",
"status": "succeeded",
"created_at": "2023-09-10T01:00:45.301575Z",
"started_at": "2023-09-10T01:00:45.284827Z",
"completed_at": "2023-09-10T01:00:47.096828Z",
"urls": {
"cancel": "https://api.replicate.com/v1/predictions/ne7xpebbqyyy6zosucw5ygai7a/cancel",
"get": "https://api.replicate.com/v1/predictions/ne7xpebbqyyy6zosucw5ygai7a"
},
"metrics": {
"predict_time": 1.812001,
"total_time": 1.795253
}
}
