Skip to content

Commit 8fb6794

Browse files
authored
Merge pull request #2265 from opendatalab/release-1.3.5
Release 1.3.5
2 parents a2b07bf + af53a46 commit 8fb6794

File tree

3 files changed

+16
-24
lines changed

3 files changed

+16
-24
lines changed

Diff for: docker/ascend_npu/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ RUN /bin/bash -c "wget https://gcore.jsdelivr.net/gh/opendatalab/MinerU@master/m
3636
source /opt/mineru_venv/bin/activate && \
3737
pip3 install --upgrade pip -i https://mirrors.aliyun.com/pypi/simple && \
3838
pip3 install torch==2.3.1 torchvision==0.18.1 -i https://mirrors.aliyun.com/pypi/simple && \
39-
pip3 install -U magic-pdf[full] -i https://mirrors.aliyun.com/pypi/simple && \
39+
pip3 install -U magic-pdf[full] 'numpy<2' decorator attrs absl-py cloudpickle ml-dtypes tornado einops -i https://mirrors.aliyun.com/pypi/simple && \
4040
wget https://gitee.com/ascend/pytorch/releases/download/v6.0.rc2-pytorch2.3.1/torch_npu-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl && \
4141
pip3 install torch_npu-2.3.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl"
4242

Diff for: magic_pdf/utils/office_to_pdf.py

+13-22
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,33 @@
44
from pathlib import Path
55
import shutil
66

7+
from loguru import logger
8+
79

810
class ConvertToPdfError(Exception):
911
def __init__(self, msg):
1012
self.msg = msg
1113
super().__init__(self.msg)
1214

1315

14-
# Chinese font list
15-
REQUIRED_CHS_FONTS = ['SimSun', 'Microsoft YaHei', 'Noto Sans CJK SC']
16-
17-
1816
def check_fonts_installed():
1917
"""Check if required Chinese fonts are installed."""
2018
system_type = platform.system()
2119

22-
if system_type == 'Windows':
23-
# Windows: check fonts via registry or system font folder
24-
font_dir = Path("C:/Windows/Fonts")
25-
installed_fonts = [f.name for f in font_dir.glob("*.ttf")]
26-
if any(font for font in REQUIRED_CHS_FONTS if any(font in f for f in installed_fonts)):
27-
return True
28-
raise EnvironmentError(
29-
f"Missing Chinese font. Please install at least one of: {', '.join(REQUIRED_CHS_FONTS)}"
30-
)
20+
if system_type in ['Windows', 'Darwin']:
21+
pass
3122
else:
32-
# Linux/macOS: use fc-list
23+
# Linux: use fc-list
3324
try:
3425
output = subprocess.check_output(['fc-list', ':lang=zh'], encoding='utf-8')
35-
for font in REQUIRED_CHS_FONTS:
36-
if font in output:
37-
return True
38-
raise EnvironmentError(
39-
f"Missing Chinese font. Please install at least one of: {', '.join(REQUIRED_CHS_FONTS)}"
40-
)
41-
except Exception as e:
42-
raise EnvironmentError(f"Font detection failed. Please install 'fontconfig' and fonts: {str(e)}")
26+
if output.strip(): # 只要有任何输出(非空)
27+
return True
28+
else:
29+
logger.warning(
30+
f"No Chinese fonts were detected, the converted document may not display Chinese content properly."
31+
)
32+
except Exception:
33+
pass
4334

4435

4536
def get_soffice_command():

Diff for: tests/unittest/test_table/test_rapidtable.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import unittest
2+
import os
23
from PIL import Image
34
from lxml import etree
45

@@ -8,7 +9,7 @@
89

910
class TestppTableModel(unittest.TestCase):
1011
def test_image2html(self):
11-
img = Image.open("assets/table.jpg")
12+
img = Image.open(os.path.join(os.path.dirname(__file__), "assets/table.jpg"))
1213
atom_model_manager = AtomModelSingleton()
1314
ocr_engine = atom_model_manager.get_atom_model(
1415
atom_model_name='ocr',

0 commit comments

Comments
 (0)