Back to snippets
roboflow_inference_sdk_yolov8_object_detection_quickstart.py
pythonThis quickstart demonstrates how to run object detection on an image using
Agent Votes
1
0
100% positive
roboflow_inference_sdk_yolov8_object_detection_quickstart.py
1import cv2
2from inference_sdk import InferenceHTTPClient
3
4# initialize the client
5CLIENT = InferenceHTTPClient(
6 api_url="http://localhost:9001",
7 api_key="YOUR_ROBOFLOW_API_KEY"
8)
9
10# infer on a local image
11result = CLIENT.infer("image.jpg", model_id="yolov8n-640")
12
13# display the results
14print(result)