Docs: Inference API Updates (#16462)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/16482/head^2
Sergiu Waxmann 2 months ago committed by GitHub
parent ba949830bf
commit 2f1e6e8fdc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 68
      docs/en/hub/inference-api.md
  2. 3
      docs/mkdocs_github_authors.yaml

@ -66,14 +66,14 @@ To access the [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API u
```python
import requests
# API URL, use actual MODEL_ID
url = "https://api.ultralytics.com/v1/predict/MODEL_ID"
# API URL
url = "https://predict.ultralytics.com"
# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}
# Inference arguments (optional)
data = {"imgsz": 640, "conf": 0.25, "iou": 0.45}
# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}
# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
@ -94,8 +94,9 @@ print(response.json())
To access the [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API using cURL, use the following code:
```bash
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
-H "x-api-key: API_KEY" \
curl -X POST "https://predict.ultralytics.com" \
-H "x-api-key: API_KEY" \
-F "model=https://hub.ultralytics.com/models/MODEL_ID" \
-F "file=@/path/to/image.jpg" \
-F "imgsz=640" \
-F "conf=0.25" \
@ -145,8 +146,9 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
=== "cURL"
```bash
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
curl -X POST "https://predict.ultralytics.com" \
-H "x-api-key: API_KEY" \
-F "model=https://hub.ultralytics.com/models/MODEL_ID" \
-F "file=@/path/to/image.jpg" \
-F "imgsz=640" \
-F "conf=0.25" \
@ -158,14 +160,14 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
```python
import requests
# API URL, use actual MODEL_ID
url = "https://api.ultralytics.com/v1/predict/MODEL_ID"
# API URL
url = "https://predict.ultralytics.com"
# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}
# Inference arguments (optional)
data = {"imgsz": 640, "conf": 0.25, "iou": 0.45}
# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}
# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
@ -225,8 +227,9 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
=== "cURL"
```bash
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
curl -X POST "https://predict.ultralytics.com" \
-H "x-api-key: API_KEY" \
-F "model=https://hub.ultralytics.com/models/MODEL_ID" \
-F "file=@/path/to/image.jpg" \
-F "imgsz=640" \
-F "conf=0.25" \
@ -238,14 +241,14 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
```python
import requests
# API URL, use actual MODEL_ID
url = "https://api.ultralytics.com/v1/predict/MODEL_ID"
# API URL
url = "https://predict.ultralytics.com"
# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}
# Inference arguments (optional)
data = {"imgsz": 640, "conf": 0.25, "iou": 0.45}
# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}
# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
@ -311,8 +314,9 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
=== "cURL"
```bash
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
curl -X POST "https://predict.ultralytics.com" \
-H "x-api-key: API_KEY" \
-F "model=https://hub.ultralytics.com/models/MODEL_ID" \
-F "file=@/path/to/image.jpg" \
-F "imgsz=640" \
-F "conf=0.25" \
@ -324,14 +328,14 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
```python
import requests
# API URL, use actual MODEL_ID
url = "https://api.ultralytics.com/v1/predict/MODEL_ID"
# API URL
url = "https://predict.ultralytics.com"
# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}
# Inference arguments (optional)
data = {"imgsz": 640, "conf": 0.25, "iou": 0.45}
# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}
# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
@ -401,8 +405,9 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
=== "cURL"
```bash
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
curl -X POST "https://predict.ultralytics.com" \
-H "x-api-key: API_KEY" \
-F "model=https://hub.ultralytics.com/models/MODEL_ID" \
-F "file=@/path/to/image.jpg" \
-F "imgsz=640" \
-F "conf=0.25" \
@ -414,14 +419,14 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
```python
import requests
# API URL, use actual MODEL_ID
url = "https://api.ultralytics.com/v1/predict/MODEL_ID"
# API URL
url = "https://predict.ultralytics.com"
# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}
# Inference arguments (optional)
data = {"imgsz": 640, "conf": 0.25, "iou": 0.45}
# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}
# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:
@ -501,8 +506,9 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
=== "cURL"
```bash
curl -X POST "https://api.ultralytics.com/v1/predict/MODEL_ID" \
curl -X POST "https://predict.ultralytics.com" \
-H "x-api-key: API_KEY" \
-F "model=https://hub.ultralytics.com/models/MODEL_ID" \
-F "file=@/path/to/image.jpg" \
-F "imgsz=640" \
-F "conf=0.25" \
@ -514,14 +520,14 @@ The [Ultralytics HUB](https://www.ultralytics.com/hub) Inference API returns a J
```python
import requests
# API URL, use actual MODEL_ID
url = "https://api.ultralytics.com/v1/predict/MODEL_ID"
# API URL
url = "https://predict.ultralytics.com"
# Headers, use actual API_KEY
headers = {"x-api-key": "API_KEY"}
# Inference arguments (optional)
data = {"imgsz": 640, "conf": 0.25, "iou": 0.45}
# Inference arguments (use actual MODEL_ID)
data = {"model": "https://hub.ultralytics.com/models/MODEL_ID", "imgsz": 640, "conf": 0.25, "iou": 0.45}
# Load image and send request
with open("path/to/image.jpg", "rb") as image_file:

@ -133,6 +133,9 @@ sometimesocrazy@gmail.com:
stormsson@users.noreply.github.com:
avatar: https://avatars.githubusercontent.com/u/1133032?v=4
username: stormsson
waxmann.sergiu@me.com:
avatar: https://avatars.githubusercontent.com/u/47978446?v=4
username: sergiuwaxmann
web@ultralytics.com:
avatar: https://avatars.githubusercontent.com/u/135830346?v=4
username: UltralyticsAssistant

Loading…
Cancel
Save