소스 검색

refactor(model): remove unused code and simplify OCR model initialization

- Remove unused code for copying detection and recognition models
- Simplify OCR model initialization using atom_model_manager
- Delete unnecessary comments and empty lines
myhloli 1 년 전
부모
커밋
4b0f11769d
1개의 변경된 파일0개의 추가작업 그리고 13개의 파일을 삭제
  1. 0 13
      magic_pdf/model/pdf_extract_kit.py

+ 0 - 13
magic_pdf/model/pdf_extract_kit.py

@@ -282,8 +282,6 @@ class CustomPEKModel:
             )
         # 初始化ocr
         if self.apply_ocr:
-
-            # self.ocr_model = ModifiedPaddleOCR(show_log=show_log, det_db_box_thresh=0.3)
             self.ocr_model = atom_model_manager.get_atom_model(
                 atom_model_name=AtomicModel.OCR,
                 ocr_show_log=show_log,
@@ -301,17 +299,6 @@ class CustomPEKModel:
                 device=self.device
             )
 
-            home_directory = Path.home()
-            det_source = os.path.join(models_dir, table_model_dir, DETECT_MODEL_DIR)
-            rec_source = os.path.join(models_dir, table_model_dir, REC_MODEL_DIR)
-            det_dest_dir = os.path.join(home_directory, PP_DET_DIRECTORY)
-            rec_dest_dir = os.path.join(home_directory, PP_REC_DIRECTORY)
-
-            if not os.path.exists(det_dest_dir):
-                shutil.copytree(det_source, det_dest_dir)
-            if not os.path.exists(rec_dest_dir):
-                shutil.copytree(rec_source, rec_dest_dir)
-
         logger.info('DocAnalysis init done!')
 
     def __call__(self, image):