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.
hilongjw /section-ui-detector:b19020b3
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 hilongjw/section-ui-detector using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
const output = await replicate.run(
"hilongjw/section-ui-detector:b19020b3472913dbc22cb492ee0904f13ac27d19788bb532da52a5937b499a27",
{
input: {
iou: 0.45,
image: "https://replicate.delivery/pbxt/JWZEcff1EUyEIrqYk3M3rMyR1vHof0hOjI1rRWRsBhM48set/screenshot-20230913-155621.png",
imgsz: 640,
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=<paste-your-token-here>
Find your API token in your account settings.
import replicate
Run hilongjw/section-ui-detector using Replicate’s API. Check out the model's schema for an overview of inputs and outputs.
output = replicate.run(
"hilongjw/section-ui-detector:b19020b3472913dbc22cb492ee0904f13ac27d19788bb532da52a5937b499a27",
input={
"iou": 0.45,
"image": "https://replicate.delivery/pbxt/JWZEcff1EUyEIrqYk3M3rMyR1vHof0hOjI1rRWRsBhM48set/screenshot-20230913-155621.png",
"imgsz": 640,
"show_conf": True,
"show_text": True,
"threshold": 0.6
}
)
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 hilongjw/section-ui-detector 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/section-ui-detector:b19020b3472913dbc22cb492ee0904f13ac27d19788bb532da52a5937b499a27",
"input": {
"iou": 0.45,
"image": "https://replicate.delivery/pbxt/JWZEcff1EUyEIrqYk3M3rMyR1vHof0hOjI1rRWRsBhM48set/screenshot-20230913-155621.png",
"imgsz": 640,
"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.
Output
{
"completed_at": "2023-09-14T04:13:00.028635Z",
"created_at": "2023-09-14T04:11:56.939518Z",
"data_removed": false,
"error": null,
"id": "mtcc4gzbnhklycbf35eog5qff4",
"input": {
"iou": 0.45,
"image": "https://replicate.delivery/pbxt/JWZEcff1EUyEIrqYk3M3rMyR1vHof0hOjI1rRWRsBhM48set/screenshot-20230913-155621.png",
"imgsz": 640,
"show_conf": true,
"show_text": true,
"threshold": 0.6
},
"logs": "image /tmp/tmpow0rlx32screenshot-20230913-155621.png\nimg_path /tmp/tmpow0rlx32screenshot-20230913-155621.png\n0: 608x640 8 Containers, 20 Titles, 2 Icons, 3 Paragraphs, 2 ContainerPills, 1 SectionImage, 131.4ms\nSpeed: 12.8ms preprocess, 131.4ms inference, 2.9ms postprocess per image at shape (1, 3, 608, 640)\nresult: ultralytics.engine.results.Results object with attributes:\nboxes: ultralytics.engine.results.Boxes object\nkeypoints: None\nkeys: ['boxes']\nmasks: None\nnames: {0: 'Container', 1: 'Title', 2: 'Image', 3: 'Icon', 4: 'Paragraph', 5: 'Background', 6: 'IrregularImage', 7: 'BackgroundImage', 8: 'ContainerPill', 9: 'ContainerCircle', 10: 'ImageCircle', 11: 'Section', 12: 'SectionImage', 13: 'SectionGradient'}\norig_img: array([[[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0],\n...,\n[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0]],\n[[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0],\n...,\n[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0]],\n[[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0],\n...,\n[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0]],\n...,\n[[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0],\n...,\n[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0]],\n[[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0],\n...,\n[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0]],\n[[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0],\n...,\n[0, 0, 0],\n[0, 0, 0],\n[0, 0, 0]]], dtype=uint8)\norig_shape: (1544, 1708)\npath: '/tmp/tmpow0rlx32screenshot-20230913-155621.png'\nprobs: None\nsave_dir: None\nspeed: {'preprocess': 12.766122817993164, 'inference': 131.4380168914795, 'postprocess': 2.891063690185547}",
"metrics": {
"predict_time": 3.735636,
"total_time": 63.089117
},
"output": "https://pbxt.replicate.delivery/MQInzzskUW5eKKtg9CQ9OsvSee8UUYDUiQnfvu5Sim5skOQGB/output_tmpow0rlx32screenshot-20230913-155621.png",
"started_at": "2023-09-14T04:12:56.292999Z",
"status": "succeeded",
"urls": {
"get": "https://api.replicate.com/v1/predictions/mtcc4gzbnhklycbf35eog5qff4",
"cancel": "https://api.replicate.com/v1/predictions/mtcc4gzbnhklycbf35eog5qff4/cancel"
},
"version": "b19020b3472913dbc22cb492ee0904f13ac27d19788bb532da52a5937b499a27"
}
image /tmp/tmpow0rlx32screenshot-20230913-155621.png
img_path /tmp/tmpow0rlx32screenshot-20230913-155621.png
0: 608x640 8 Containers, 20 Titles, 2 Icons, 3 Paragraphs, 2 ContainerPills, 1 SectionImage, 131.4ms
Speed: 12.8ms preprocess, 131.4ms inference, 2.9ms postprocess per image at shape (1, 3, 608, 640)
result: ultralytics.engine.results.Results object with attributes:
boxes: ultralytics.engine.results.Boxes object
keypoints: None
keys: ['boxes']
masks: None
names: {0: 'Container', 1: 'Title', 2: 'Image', 3: 'Icon', 4: 'Paragraph', 5: 'Background', 6: 'IrregularImage', 7: 'BackgroundImage', 8: 'ContainerPill', 9: 'ContainerCircle', 10: 'ImageCircle', 11: 'Section', 12: 'SectionImage', 13: 'SectionGradient'}
orig_img: array([[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
...,
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]],
[[0, 0, 0],
[0, 0, 0],
[0, 0, 0],
...,
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]], dtype=uint8)
orig_shape: (1544, 1708)
path: '/tmp/tmpow0rlx32screenshot-20230913-155621.png'
probs: None
save_dir: None
speed: {'preprocess': 12.766122817993164, 'inference': 131.4380168914795, 'postprocess': 2.891063690185547}