from abc import ABC, abstractmethod import numpy as np from typing import List, Dict, Any class OCRBackend(ABC): """Base class for OCR backends.""" @abstractmethod async def initialize(self): """Initialize the OCR model.""" pass @abstractmethod def detect(self, image: np.ndarray) -> List[Dict]: """Detect text in an image.""" pass class ObjectDetector(ABC): """Base class for object detectors.""" @abstractmethod async def initialize(self): """Initialize the object detection model.""" pass @abstractmethod def detect(self, image: np.ndarray) -> List[Dict]: """Detect objects in an image.""" pass