Spaces:
Sleeping
Sleeping
File size: 583 Bytes
fad436e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | from abc import ABC, abstractmethod
from typing import List, Dict, Any
class BaseEngine(ABC):
@abstractmethod
def process(self, image_path: str) -> Any:
pass
class BaseOCR(BaseEngine):
@abstractmethod
def extract_text(self, image_path: str) -> str:
pass
class BaseVLM(BaseEngine):
@abstractmethod
def extract_structured_data(self, image_path: str, prompt: str) -> Dict[str, Any]:
pass
class BaseNER(BaseEngine):
@abstractmethod
def extract_entities(self, text: str, labels: List[str]) -> Dict[str, List[str]]:
pass
|