Spaces:
Sleeping
Sleeping
File size: 415 Bytes
ae4fcd6 6add590 3764f91 ae4fcd6 6add590 3764f91 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | from ultralytics import YOLO
# Carregamento único do modelo
_model = None
def load_model(model_path):
global _model
if _model is None:
_model = YOLO(model_path)
return _model
def detect_bubbles(model_path, image):
"""
Detecta bolhas na página e retorna bounding boxes.
"""
model = load_model(model_path)
results = model(image)[0]
return results.boxes.data.tolist()
|