WebashalarForML commited on
Commit
4e653b1
1 Parent(s): 9a4bf63

Update utility/utils.py

Browse files
Files changed (1) hide show
  1. utility/utils.py +6 -4
utility/utils.py CHANGED
@@ -113,11 +113,13 @@ def ocr_with_paddle(img):
113
  #model_dir = os.getenv('PADDLEOCR_MODEL_DIR', '/tmp/.paddleocr')
114
  #ocr = PaddleOCR(lang='en', use_angle_cls=True, det_model_dir=model_dir)
115
  #ocr = PaddleOCR(lang='en', use_angle_cls=True, det_model_dir=os.environ['PADDLEOCR_HOME'])
 
116
  ocr = PaddleOCR(
117
- lang='en',
118
- use_angle_cls=True,
119
- rec_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/rec/en/en_PP-OCRv4_rec_infer'),
120
- det_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/det')
 
121
  )
122
 
123
  result = ocr.ocr(img)
 
113
  #model_dir = os.getenv('PADDLEOCR_MODEL_DIR', '/tmp/.paddleocr')
114
  #ocr = PaddleOCR(lang='en', use_angle_cls=True, det_model_dir=model_dir)
115
  #ocr = PaddleOCR(lang='en', use_angle_cls=True, det_model_dir=os.environ['PADDLEOCR_HOME'])
116
+ logging.info(f"PADDLEOCR_HOME: {os.environ['PADDLEOCR_HOME']}")
117
  ocr = PaddleOCR(
118
+ lang='en',
119
+ use_angle_cls=True,
120
+ det_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/det'),
121
+ rec_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/rec/en/en_PP-OCRv4_rec_infer'),
122
+ cls_model_dir=os.path.join(os.environ['PADDLEOCR_HOME'], 'whl/cls/ch_ppocr_mobile_v2.0_cls_infer')
123
  )
124
 
125
  result = ocr.ocr(img)