Spaces:
Build error
Build error
| from typing import Any, List, Literal, Mapping, Optional, Tuple | |
| from abc import ABC, abstractmethod | |
| import numpy as np | |
| import cv2 | |
| from PIL import Image | |
| from abc import ABC, abstractmethod | |
| from utils import cropImage | |
| class OCRComponent: | |
| """ | |
| Wrapper class for cropping images and giving it to OCR Predictor | |
| """ | |
| def predict_pdf(self, pdf_name:str="", page:int=None, bbx:List[List[float]]=None)-> List[List[float]]: | |
| #TODO: Preprocessing to crop interest region | |
| pass | |
| class TextDetector(ABC): | |
| """ | |
| Abstract base class for text detectors that takes in bounding boxes, pdf name, and page | |
| and returns bounding boxes results on them. | |
| """ | |
| def __init__(self): | |
| pass | |
| """ | |
| This is for predicting given an already cropped image | |
| """ | |
| def predict_img(self, img:np.ndarray=None)-> List[List[float]]: | |
| # do something with self.input and return bbx | |
| pass | |
| class textRecognizer(ABC): | |
| """ | |
| class of textRecognizer that takes in bounding boxes, pdf name and page and returns | |
| OCR results on them | |
| """ | |
| def __init__(self): | |
| pass | |
| """ | |
| This is for predicting given text line detection result form text line detector | |
| """ | |
| def predict_img(self, bxs:List[List[float]], img:Image.Image)-> List[List[float]]: | |
| # do something with self.input and return bbx | |
| pass | |