File size: 537 Bytes
57e29e3
 
db7fb96
57e29e3
 
 
 
 
 
db7fb96
57e29e3
 
db7fb96
57e29e3
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import json
import requests

# Run inference on an image
url = "https://predict.ultralytics.com"
headers = {"x-api-key": "2f5030f67d8682095078407a9380643a5ddd89d13c"}
data = {"model": "https://hub.ultralytics.com/models/5NOJhLhigIjjuOABqyUQ", "imgsz": 640, "conf": 0.25, "iou": 0.45}
with open("path/to/image.jpg", "rb") as f:
	response = requests.post(url, headers=headers, data=data, files={"file": f})

# Check for successful response
response.raise_for_status()

# Print inference results
print(json.dumps(response.json(), indent=2))