|
|
|
@ -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: |
|
|
|
|