mineru 2.5.3__py3-none-any.whl → 2.5.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mineru/cli/common.py CHANGED
@@ -26,7 +26,7 @@ def read_fn(path):
26
26
  path = Path(path)
27
27
  with open(str(path), "rb") as input_file:
28
28
  file_bytes = input_file.read()
29
- file_suffix = guess_suffix_by_bytes(file_bytes)
29
+ file_suffix = guess_suffix_by_bytes(file_bytes, path)
30
30
  if file_suffix in image_suffixes:
31
31
  return images_bytes_to_pdf_bytes(file_bytes)
32
32
  elif file_suffix in pdf_suffixes:
mineru/cli/gradio_app.py CHANGED
@@ -86,10 +86,14 @@ def replace_image_with_base64(markdown_text, image_dir_path):
86
86
  # 替换图片链接
87
87
  def replace(match):
88
88
  relative_path = match.group(1)
89
- full_path = os.path.join(image_dir_path, relative_path)
90
- base64_image = image_to_base64(full_path)
91
- return f'![{relative_path}](data:image/jpeg;base64,{base64_image})'
92
-
89
+ # 只处理以.jpg结尾的图片
90
+ if relative_path.endswith('.jpg'):
91
+ full_path = os.path.join(image_dir_path, relative_path)
92
+ base64_image = image_to_base64(full_path)
93
+ return f'![{relative_path}](data:image/jpeg;base64,{base64_image})'
94
+ else:
95
+ # 其他格式的图片保持原样
96
+ return match.group(0)
93
97
  # 应用替换
94
98
  return re.sub(pattern, replace, markdown_text)
95
99
 
@@ -1,3 +1,5 @@
1
+ from pathlib import Path
2
+
1
3
  from magika import Magika
2
4
 
3
5
 
@@ -10,11 +12,17 @@ def guess_language_by_text(code):
10
12
  return lang if lang != "unknown" else DEFAULT_LANG
11
13
 
12
14
 
13
- def guess_suffix_by_bytes(file_bytes) -> str:
15
+ def guess_suffix_by_bytes(file_bytes, file_path=None) -> str:
14
16
  suffix = magika.identify_bytes(file_bytes).prediction.output.label
17
+ if file_path and suffix in ["ai"] and Path(file_path).suffix.lower() in [".pdf"]:
18
+ suffix = "pdf"
15
19
  return suffix
16
20
 
17
21
 
18
22
  def guess_suffix_by_path(file_path) -> str:
23
+ if not isinstance(file_path, Path):
24
+ file_path = Path(file_path)
19
25
  suffix = magika.identify_path(file_path).prediction.output.label
26
+ if suffix in ["ai"] and file_path.suffix.lower() in [".pdf"]:
27
+ suffix = "pdf"
20
28
  return suffix
mineru/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.5.3"
1
+ __version__ = "2.5.4"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mineru
3
- Version: 2.5.3
3
+ Version: 2.5.4
4
4
  Summary: A practical tool for converting PDF to Markdown
5
5
  License: AGPL-3.0
6
6
  Project-URL: homepage, https://mineru.net/
@@ -37,7 +37,7 @@ Requires-Dist: scikit-image<1.0.0,>=0.25.0
37
37
  Requires-Dist: openai<2,>=1.70.0
38
38
  Requires-Dist: beautifulsoup4<5,>=4.13.5
39
39
  Requires-Dist: magika<0.7.0,>=0.6.2
40
- Requires-Dist: mineru-vl-utils<1,>=0.1.8
40
+ Requires-Dist: mineru-vl-utils<1,>=0.1.11
41
41
  Provides-Extra: test
42
42
  Requires-Dist: mineru[core]; extra == "test"
43
43
  Requires-Dist: pytest; extra == "test"
@@ -127,6 +127,9 @@ Dynamic: license-file
127
127
 
128
128
  # Changelog
129
129
 
130
+ - 2025/09/26 2.5.4 released
131
+ - Fixed an issue where some `PDF` files were mistakenly identified as `AI` files, causing parsing failures
132
+
130
133
  - 2025/09/20 2.5.3 Released
131
134
  - Dependency version range adjustment to enable Turing and earlier architecture GPUs to use vLLM acceleration for MinerU2.5 model inference.
132
135
  - `pipeline` backend compatibility fixes for torch 2.8.0.
@@ -1,5 +1,5 @@
1
1
  mineru/__init__.py,sha256=8CRrCQVuExa0BttRFh3Z40lFy2K5jN0sp67KWjOlj5c,50
2
- mineru/version.py,sha256=9As6EseYF3Vi8VWUZnZuuTi-kW5fYIv8u6cHK0RidGo,22
2
+ mineru/version.py,sha256=u7qJtvbcGbgT3ue2tQMbSOeGJqqkDTDm-_7HUe49PZA,22
3
3
  mineru/backend/__init__.py,sha256=8CRrCQVuExa0BttRFh3Z40lFy2K5jN0sp67KWjOlj5c,50
4
4
  mineru/backend/pipeline/__init__.py,sha256=8CRrCQVuExa0BttRFh3Z40lFy2K5jN0sp67KWjOlj5c,50
5
5
  mineru/backend/pipeline/batch_analyze.py,sha256=dOnktvOMjfg84w1H34YlJg6N9_x6Yfvf14NIpOQcZqQ,22221
@@ -18,9 +18,9 @@ mineru/backend/vlm/vlm_magic_model.py,sha256=o1WKwgArV0f4lp7ufmSq9zRZaM5bnfOdx1A
18
18
  mineru/backend/vlm/vlm_middle_json_mkcontent.py,sha256=Ie95XpwTgi7EmidcwE_scvXMRQjE2xASU_Rm_F8EP-I,13377
19
19
  mineru/cli/__init__.py,sha256=8CRrCQVuExa0BttRFh3Z40lFy2K5jN0sp67KWjOlj5c,50
20
20
  mineru/cli/client.py,sha256=uo7db9Wqj1Mc11MYuaM-bi54BfKKU3SFB9Urc8md5X4,6641
21
- mineru/cli/common.py,sha256=yJPdrwSYVidl2hTJ2Hn2YhnfH97GJ-QZi20dGFz7h5c,14025
21
+ mineru/cli/common.py,sha256=HNJA6wVue1k8uZJlkEb9bTJfmLRc2CjemPB2o7ZosCk,14031
22
22
  mineru/cli/fast_api.py,sha256=-GDT4gOCjKQrRjrx9WVJw-D-EC7Adv-F2rAiSWdl2CA,11328
23
- mineru/cli/gradio_app.py,sha256=m1ppNVVOS-gdMpQPWOgHQCBQkLZ4B6gKCZuUyhfsR1g,13482
23
+ mineru/cli/gradio_app.py,sha256=z59i5cWKLQ6TC7EwNKWEcrMHkz3Lsf1LYJTHXVpJiVo,13674
24
24
  mineru/cli/models_download.py,sha256=TCKtzTRJ-ShaqZnRQID40QsILqp2b3basU142FMTmns,4775
25
25
  mineru/cli/vlm_vllm_server.py,sha256=fQJyD-gIPQ41hR_6aIaDJczl66N310t0CiZEBAfX5mc,90
26
26
  mineru/data/__init__.py,sha256=8CRrCQVuExa0BttRFh3Z40lFy2K5jN0sp67KWjOlj5c,50
@@ -157,7 +157,7 @@ mineru/utils/cut_image.py,sha256=g3m4nfcJNWlxi-P0kpXTtlmspXkMcLCfGwmYuQ-Z2hE,751
157
157
  mineru/utils/draw_bbox.py,sha256=FkgppjUzRhN-uxvChdkhHXcDavJEaApMD6qC6qoRwfQ,20292
158
158
  mineru/utils/enum_class.py,sha256=34lVsjeAYLha7Q-1qxY9seJFdK6fjuEphXfYFibghEY,2442
159
159
  mineru/utils/format_utils.py,sha256=2s89vHcSISjuolk8Hvg3K-5-rRbiT3Us7eFLzUKrNKs,10233
160
- mineru/utils/guess_suffix_or_lang.py,sha256=q7CbPpiaDFA2AmOS66oJ_HwzamEftNSsmOn5mbrtO9I,540
160
+ mineru/utils/guess_suffix_or_lang.py,sha256=nznyQpUn1BSA8JNw9HuG3pVV-xtVAtrtcGuHZ-VXt9M,856
161
161
  mineru/utils/hash_utils.py,sha256=UPS_8NRBmVumdyOv16Lmv6Ly2xK8OVDJEe5gG6gKIFk,857
162
162
  mineru/utils/language.py,sha256=7RT3mxSa7jdpoC5ySd7ZddHA7TO7UsnmDOWiYZAxuyg,1433
163
163
  mineru/utils/llm_aided.py,sha256=0W6AlBpLfflON1ob6p72IgwdCJKFXhYpDWlrhrToR5s,4892
@@ -173,9 +173,9 @@ mineru/utils/run_async.py,sha256=rPeP4BCZerR8VByRDhiYzfZiahLVqoZEBVAS54dAjNg,128
173
173
  mineru/utils/span_block_fix.py,sha256=0eVQjJCrT03woRt9hoh6Uu42Tp1dacfGTv2x3B9qq94,8797
174
174
  mineru/utils/span_pre_proc.py,sha256=h41q2uQajI0xQbc_30hqaju1dv3oVYxBAlKgURl8HIc,13692
175
175
  mineru/utils/table_merge.py,sha256=zYUpYLrfhBCnbHCYZi6rG8-s38NDnTbiNTObvLdYwJk,11494
176
- mineru-2.5.3.dist-info/licenses/LICENSE.md,sha256=jVa0BUaKrRH4erV2P5AeJ24I2WRv9chIGxditreJ6e0,34524
177
- mineru-2.5.3.dist-info/METADATA,sha256=T45OlRf2MarpDXHk36RO4Hx8EN2A15V2UJmmjTd8YCE,64957
178
- mineru-2.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
179
- mineru-2.5.3.dist-info/entry_points.txt,sha256=luXmbhPiZK_tKlRgWuYOaW_V6EFpG-yJcAevVv9MEqE,252
180
- mineru-2.5.3.dist-info/top_level.txt,sha256=zuGQfZcbsHv4I4oKI9gaKPqEWBFm6xJroKuug2LnKP8,7
181
- mineru-2.5.3.dist-info/RECORD,,
176
+ mineru-2.5.4.dist-info/licenses/LICENSE.md,sha256=jVa0BUaKrRH4erV2P5AeJ24I2WRv9chIGxditreJ6e0,34524
177
+ mineru-2.5.4.dist-info/METADATA,sha256=_D0D86ss-j3hi40UMzMYWBY9kzKNN6G_F8aRSH33fYo,65098
178
+ mineru-2.5.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
179
+ mineru-2.5.4.dist-info/entry_points.txt,sha256=luXmbhPiZK_tKlRgWuYOaW_V6EFpG-yJcAevVv9MEqE,252
180
+ mineru-2.5.4.dist-info/top_level.txt,sha256=zuGQfZcbsHv4I4oKI9gaKPqEWBFm6xJroKuug2LnKP8,7
181
+ mineru-2.5.4.dist-info/RECORD,,
File without changes