File size: 403 Bytes
bbcc5b2
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
from transformers import pipeline
from PIL import Image
from io import BytesIO

# Load the object detection pipeline
object_detection_pipeline = pipeline("object-detection", model="ciasimbaya/ObjectDetection")
def detect_objects(image_bytes):
    image = Image.open(BytesIO(image_bytes))
    result = object_detection_pipeline(image)
    return result

print("object detection model loaded succesfully")