API Reference#
OpenAPI Specification#
You can download the complete API spec
. The API spec is subject to change while in Early Access (EA). EA participants are encouraged to provide feedback to NVIDIA prior to the General Access (GA) release.
API Examples#
Compute Bounding Boxes#
The v1/infer
endpoint accepts multiple images and returns a list of bounding boxes for each image.
The only supported type
is image_url
.
Each image must be base64 encoded, and should be represented in the following JSON format.
The supported image formats are png
and jpeg
.
{
"type": "image_url",
"url": "data:image/<IMAGE_FORMAT>;base64,<BASE64_ENCODED_IMAGE>"
}
Example:
{
"type": "image_url",
"url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAB41BMVEUAAABtr0FtsUFssEJtsEJusUN0sVxtrkFtsUNztkdtsUJus0R0s0ZvskNrrT9sr0JwtUZtsEFusEJtsEJusUNusUNtsEJusUNusUNusUNtsEJusUNusUNusUNusENtsUJusUNusUNusUNtsUNusUNusUNusUNusUNusUNusUNusUNusUNtsEJusUNusUNtsEFusUJusUNusUNtsUJusEJtsEJtsENusUNusUNusUNusUNusUNtsEJusEJtsEJusUNusUNusUJusUNusUNtsEJusEJusUNusUNusUNusEJusUNusUNusEJtsUNusUNusUNtsUNusEJusUNusUNtsEFusUNusUNsrkFusUNusEJusUNusUNtsUJtsUNusUNusUJusUNusUNusUJusUJusUNusUNtsEJusEJusUNusUNssEFtsUFusUNusUNssEJusUNusUNusEJusUNusUNtsUJusEJusUNusUNssUJusUNusUNusUNusUNusUJtsEJusUJusUNtsEJusUNusUNusUJusUJusUNusUNusEJusUNusUNtsUJusUNusUNtsEJrrz9pqz5usUNusUNusUNtsEJusUNusUNusUNusEJtsUJusUNusUNusUNusUNusUNtsUJusUNteYTkAAAAoHRSTlMAAAAAAAAAAAAAAAAAAAAAAAAAJOT+Kdfz/B1bmqlGOVKL0SCAz8mUc6GYZBpr2Ahd0tBgFRVErMjp3XUOKBz0sCLKvwwyl/CmGb28GD7N02FCslwEk6oDhCHn60FKVTzl7z4t5roPIOPZCQJ4uRJpjTP9w0Mco5EQatyGh1goWcwY95shKWhuEX7WVsKZFgQBM8s1ISlFdxA8tcfU6PggwJY8TQAAAQBJREFUeJxjYAADRiZhkQWiIADmMrOwsomJS0guAAIgl52DU0paRlZOXkFRSRIowMWtrKKqpq6hqaUtrKOrx8Cib2BoZGxiamZuYWllbWPLYKdu7+Bop+LkbOvi6ubu4cngJert4+vnHxAYFMwTErpAnSFoQVh4xAJd3sio6JhYveg4hviExKTklNS09IwFmdGW0lkM2TmSuXn5EgWFKQuKiktKQxm40sokyysqq7yra2rr6hskGRhYGj2amltaK3XbFJ3sDduBLuXq6Ezo6uzu8S/ujevrBwrwsU6YqDipePKUyKnTpjuAPcfPKjBj5qzZc+bOA3sOBASF5icsAAMAFI5IFASP0tsAAAAASUVORK5CYII="
}
An inference request has an entry for input
. The value for input
is an array of dictionaries that contain fields type
and url
. For example, a JSON payload of three images looks like the following:
{
"input": [
{
"type": "image_url",
"url": "data:img/png;base64,<BASE64_ENCODED_IMAGE>"
},
{
"type": "image_url",
"url": "data:img/png;base64,<BASE64_ENCODED_IMAGE>"
},
{
"type": "image_url",
"url": "data:img/png;base64,<BASE64_ENCODED_IMAGE>"
}
]
}
cURL Request
HOSTNAME="localhost"
SERVICE_PORT=8000
curl -X "POST" \
"http://${HOSTNAME}:${SERVICE_PORT}/v1/infer" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"input": [
{
"type": "image_url",
"url": "data:img/png;base64,<BASE64_ENCODED_IMAGE>"
},
{
"type": "image_url",
"url": "data:img/png;base64,<BASE64_ENCODED_IMAGE>"
}
]
}'
Response
{
"data": [
{
"index": 0,
"bounding_boxes": {
"chart": [
{
"x_min": 0.3982,
"y_min": 0.1893,
"x_max": 0.9104,
"y_max": 0.908,
"confidence": 0.6608
}
],
"title": [
{
"x_min": 0.0718,
"y_min": 0.0883,
"x_max": 0.6523,
"y_max": 0.135,
"confidence": 0.8328
},
{
"x_min": 0.0722,
"y_min": 0.1995,
"x_max": 0.2808,
"y_max": 0.2923,
"confidence": 0.2233
},
]
}
},
{
"index": 1,
"bounding_boxes": {
"chart": [
{
"x_min": 0.0186,
"y_min": 0.1432,
"x_max": 0.9814,
"y_max": 0.963,
"confidence": 0.718
}
],
"title": [
{
"x_min": 0.0211,
"y_min": 0.016,
"x_max": 0.3102,
"y_max": 0.0578,
"confidence": 0.1601
}
]
}
}
]
}
Health Check#
cURL Request
Use the following command to query the health endpoints.
HOSTNAME="localhost"
SERVICE_PORT=8000
curl "http://${HOSTNAME}:${SERVICE_PORT}/v1/health/ready" \
-H 'Accept: application/json'
HOSTNAME="localhost"
SERVICE_PORT=8000
curl "http://${HOSTNAME}:${SERVICE_PORT}/v1/health/live" \
-H 'Accept: application/json'
Response
{
"ready": true
}
{
"live": true
}