Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
feat: add tqdm_progress_bar parameter for enhanced progress tracking in OCR prediction
myhloli05e37c28ba78
diff --git a/mineru/model/ocr/pytorch_paddle.py b/mineru/model/ocr/pytorch_paddle.pyindex 08db11ed..48743bfe 100644--- a/mineru/model/ocr/pytorch_paddle.py+++ b/mineru/model/ocr/pytorch_paddle.py@@ -289,6 +289,7 @@ class PytorchPaddleOCR(TextSystem):mfd_res=None,tqdm_enable=False,tqdm_desc="OCR-rec Predict",+ tqdm_progress_bar=None,):assert isinstance(img, (np.ndarray, list, str, bytes))if isinstance(img, list) and det == True:@@ -338,7 +339,12 @@ class PytorchPaddleOCR(TextSystem):if not isinstance(img, list):img = preprocess_image(img)img = [img]- rec_res, elapse = self.text_recognizer(img, tqdm_enable=tqdm_enable, tqdm_desc=tqdm_desc)+ rec_res, elapse = self.text_recognizer(+ img,+ tqdm_enable=tqdm_enable,+ tqdm_desc=tqdm_desc,+ tqdm_progress_bar=tqdm_progress_bar,+ )# logger.debug("rec_res num : {}, elapsed : {}".format(len(rec_res), elapse))ocr_res.append(rec_res)return ocr_resdiff --git a/mineru/model/utils/tools/infer/predict_rec.py b/mineru/model/utils/tools/infer/predict_rec.pyindex 8bcd8555..0ece92fc 100644--- a/mineru/model/utils/tools/infer/predict_rec.py+++ b/mineru/model/utils/tools/infer/predict_rec.py@@ -288,7 +288,7 @@ class TextRecognizer(BaseOCRV20):return img- def __call__(self, img_list, tqdm_enable=False, tqdm_desc="OCR-rec Predict"):+ def __call__(self, img_list, tqdm_enable=False, tqdm_desc="OCR-rec Predict", tqdm_progress_bar=None):img_num = len(img_list)# Calculate the aspect ratio of all text barswidth_list = []@@ -428,6 +428,8 @@ class TextRecognizer(BaseOCRV20):current_batch_size = min(batch_num, img_num - index * batch_num)index += 1pbar.update(current_batch_size)+ if tqdm_progress_bar is not None:+ tqdm_progress_bar.update(current_batch_size)# Fix NaN values in recognition resultsfor i in range(len(rec_res)):