def __init__(self, find_best_rotation=True, det_model=None, ocr_model=None):
    self.find_best_rotation = find_best_rotation
    if self.find_best_rotation:
        self.crop_path = os.path.join(CACHE_DIR, 'crops')
        if os.path.exists(self.crop_path):
            shutil.rmtree(self.crop_path)
            os.mkdir(self.crop_path)
        self.det_model = (det_model if (det_model is not None) else Detection())
        self.ocr_model = (ocr_model if (ocr_model is not None) else OCR())
    self.scanner = DocScanner()
def __init__(self, find_best_rotation=True, det_model=None, ocr_model=None):
    self.find_best_rotation = find_best_rotation
    if self.find_best_rotation:
        self.crop_path = os.path.join(CACHE_DIR, 'crops')
        if os.path.exists(self.crop_path):
            shutil.rmtree(self.crop_path)
            os.mkdir(self.crop_path)
        self.det_model = (det_model if (det_model is not None) else Detection())
        self.ocr_model = (ocr_model if (ocr_model is not None) else OCR())
    self.scanner = DocScanner()