File tree Expand file tree Collapse file tree 5 files changed +54
-4
lines changed
Expand file tree Collapse file tree 5 files changed +54
-4
lines changed Original file line number Diff line number Diff line change 1+ # This is the final, recommended configuration.
2+ # It builds a single, self-contained image with all dependencies.
3+
4+ services :
5+ pdf2zh :
6+ build :
7+ context : .
8+ # All the setup steps are now part of a one-time build process.
9+ dockerfile_inline : |
10+ FROM ghcr.io/astral-sh/uv:python3.12-bookworm-slim
11+
12+ WORKDIR /app
13+
14+ # 1. Install system-level dependencies FIRST.
15+ # This is what solves the "libGL.so.1 not found" error.
16+ RUN apt-get update && \
17+ apt-get install --no-install-recommends -y libgl1 libglib2.0-0 libxext6 libsm6 libxrender1 && \
18+ rm -rf /var/lib/apt/lists/*
19+
20+ # 2. Copy only the dependency file and install Python packages.
21+ # This layer is cached and only re-runs if pyproject.toml changes.
22+ COPY pyproject.toml .
23+ RUN uv pip install --system --no-cache -r pyproject.toml
24+
25+ # 3. Copy the rest of your application code.
26+ COPY . .
27+
28+ # 4. Install the local package and perform final updates/warmups.
29+ RUN uv pip install --system --no-cache . && \
30+ uv pip install --system --no-cache -U "babeldoc<0.3.0" "pymupdf<1.25.3" "pdfminer-six==20250416" && \
31+ babeldoc --warmup
32+
33+ # The rest of the configuration is for RUNNING the built image.
34+ ports :
35+ - " 7860:7860"
36+
37+ environment :
38+ - PYTHONUNBUFFERED=1
39+ # The UV_LINK_MODE warning happens during build, so we can set it there if needed,
40+ # but it's generally harmless.
41+
42+ command : ["pdf2zh", "-i"]
43+
44+ # Optional: Mount a volume for persistent data I/O if needed
45+ # volumes:
46+ # - ./data:/app/data
47+
48+ stdin_open : true
49+ tty : true
Original file line number Diff line number Diff line change 33
44log = logging .getLogger (__name__ )
55
6- __version__ = "1.9.9 "
6+ __version__ = "1.9.10 "
77__author__ = "Byaidu"
88__all__ = ["translate" , "translate_stream" ]
Original file line number Diff line number Diff line change @@ -126,7 +126,7 @@ def translate_patch(
126126 callback (progress )
127127 page .pageno = pageno
128128 pix = doc_zh [page .pageno ].get_pixmap ()
129- image = np .fromstring (pix .samples , np .uint8 ).reshape (
129+ image = np .frombuffer (pix .samples , np .uint8 ).reshape (
130130 pix .height , pix .width , 3
131131 )[:, :, ::- 1 ]
132132 page_layout = model .predict (image , imgsz = int (pix .height / 32 ) * 32 )[0 ]
Original file line number Diff line number Diff line change @@ -287,6 +287,7 @@ def do_translate(self, text):
287287 "target_lang" : self .lang_out ,
288288 "text" : text ,
289289 },
290+ verify = False , # noqa: S506
290291 )
291292 response .raise_for_status ()
292293 return response .json ()["data" ]
Original file line number Diff line number Diff line change 11[project ]
22name = " pdf2zh"
3- version = " 1.9.9 "
3+ version = " 1.9.10 "
44description = " Latex PDF Translator"
55authors = [{ name = " Byaidu" , email = " byaidux@gmail.com" }]
66license = " AGPL-3.0"
@@ -77,7 +77,7 @@ max-line-length = 88
7777
7878
7979[bumpver ]
80- current_version = " 1.9.9 "
80+ current_version = " 1.9.10 "
8181version_pattern = " MAJOR.MINOR.PATCH[.PYTAGNUM]"
8282
8383[bumpver .file_patterns ]
You can’t perform that action at this time.
0 commit comments