Introduce Docker CPU support and improve translation process - #14
Open
kevinliddel wants to merge 7 commits into
Open
Introduce Docker CPU support and improve translation process#14kevinliddel wants to merge 7 commits into
kevinliddel wants to merge 7 commits into
Conversation
…nds and update dependencies
…adio theme in GUI
… response management
…sed OCR pass logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces experimental support for running the PDF Translator on Mac and CPU-only environments, in addition to improving the flexibility and robustness of the installation and execution process. The changes include new Docker and local installation options, a CPU-compatible Dockerfile, Makefile enhancements, and code updates to support device and backend selection at runtime.
Key changes:
1. Experimental Mac/CPU Support & Installation Instructions
README.mdto document three installation modes: Docker with NVIDIA GPU, Docker with CPU (Mac/CPU-only), and local (Mac Intel/Apple Silicon/CPU), including step-by-step instructions for each. The requirements and TODOs sections were also updated to reflect the new support. [1] [2] [3] [4]2. CPU Docker Support
docker/Dockerfile.cputo build a CPU-only Docker image with all necessary dependencies for running on non-GPU hosts.docker/Makefilewith commands to build, run, stop, and clean up both GPU and CPU containers, as well as to support local execution and logs for both modes.docker/start-cpu.shto initialize the CPU container, copy model files, and launch both the API and GUI.requirements-cpu.txtfor local CPU-based installation.3. Device and Layout Backend Selection
server/main.pyto allow dynamic selection of device (cuda,mps,cpu, orauto) and layout backend (detectron2,none, orauto) via environment variables. Added logic to fall back to CPU or a full-page layout analyzer if the requested backend is unavailable. [1] [2] [3] [4] [5] [6] [7] [8] [9]4. CLI and GUI Improvements
gui.pyto improve error handling, add file upload validation, and ensure compatibility with local and containerized modes. [1] [2] [3]5. Proof of Concept
Those changes have been tested on a MacBook 2019 Pro to verify the work:

It successfully ran the translation:

These changes make the PDF Translator more accessible to users without NVIDIA GPUs, improve installation clarity, and enhance robustness across platforms.