|
1 | | -# DeepSeek OCR Client (Fork) |
| 1 | +# DeepSeek-OCR-2 Client |
2 | 2 |
|
3 | | -Desktop Electron client for [DeepSeek-OCR](https://github.com/deepseek-ai/DeepSeek-OCR), with cross-platform packaging, queue workflows, GPU-aware setup, and first-run managed Python runtime. |
| 3 | +**A desktop OCR workspace for [DeepSeek-OCR-2](https://github.com/deepseek-ai/DeepSeek-OCR-2) with live overlay preview, queue processing, and automatic hardware-aware setup.** |
4 | 4 |
|
5 | 5 | This project is unaffiliated with DeepSeek. |
6 | 6 |
|
7 | | -## What This Fork Adds |
| 7 | + |
8 | 8 |
|
9 | | -- Managed first-run runtime via bundled `uv` (packaged builds) |
10 | | -- Hardware-aware setup path (Apple Silicon MLX, NVIDIA CUDA, CPU) |
11 | | -- Dual inference backends: |
12 | | - - Apple Silicon: `mlx` + `mlx-vlm` with `mlx-community/DeepSeek-OCR-2-8bit` |
13 | | - - Windows/Linux/Intel macOS: PyTorch backend (`torch` + `transformers`) with `deepseek-ai/DeepSeek-OCR-2` |
14 | | -- Queue processing for mixed image + PDF inputs |
15 | | -- Queue controls: pause, resume, cancel, retry failed |
16 | | -- PDF page-range support (`1-3,5`) for single OCR and queue OCR |
17 | | -- Startup/setup progress UI |
18 | | -- Preflight estimator (disk + download/time estimates) |
19 | | -- Diagnostics bundle export (for debugging/support) |
20 | | -- Retention policy UI (outputs/cache cleanup) |
21 | | -- Security hardening: preload-based API with `contextIsolation: true` |
22 | | -- Cross-platform E2E and packaging test coverage |
| 9 | +## Why This Client |
23 | 10 |
|
24 | | -## Platform Support |
| 11 | +If you want OCR that is: |
| 12 | +- local-first |
| 13 | +- fast on your available hardware |
| 14 | +- easy for non-technical users |
| 15 | +- still scriptable for advanced users |
25 | 16 |
|
26 | | -- macOS: source mode + DMG packaging |
27 | | -- Windows: source mode + NSIS packaging |
28 | | -- Linux: source mode + AppImage/deb packaging |
| 17 | +this app is designed for that exact flow. |
29 | 18 |
|
30 | | -## Requirements |
| 19 | +It gives you one desktop surface for: |
| 20 | +- image and PDF OCR |
| 21 | +- queue/batch processing |
| 22 | +- live detection overlays |
| 23 | +- setup diagnostics and retention controls |
| 24 | +- optional MCP control from Codex/CLI tooling |
31 | 25 |
|
32 | | -### End users (installer builds) |
| 26 | +## Install (Simple Path) |
33 | 27 |
|
34 | | -- No preinstalled Python required |
35 | | -- Internet access on first run (runtime + dependencies + model) |
| 28 | +1. Open the [Releases page](https://github.com/jmoore2333/deepseek-ocr-client/releases). |
| 29 | +2. Download the installer for your platform. |
| 30 | +3. Launch the app. |
| 31 | +4. On first run, let setup finish (runtime + dependencies + model preparation). |
36 | 32 |
|
37 | | -### Source/development mode |
| 33 | +## 3-Minute First OCR |
38 | 34 |
|
39 | | -- Node.js 18+ |
40 | | -- Python 3.10-3.12 |
41 | | -- Optional: NVIDIA driver/CUDA-capable GPU for CUDA acceleration |
42 | | - |
43 | | -## Quick Start |
44 | | - |
45 | | -### 1. Clone and install Node deps |
46 | | - |
47 | | -```bash |
48 | | -npm ci |
49 | | -``` |
| 35 | +1. Start the app. |
| 36 | +2. Click `Load Model`. |
| 37 | +3. Drag in an image or PDF (or click `Select File`). |
| 38 | +4. Keep `Type = Document` unless you need a different mode. |
| 39 | +5. Click `Run OCR`. |
| 40 | +6. Review output in `Output Inspector`. |
| 41 | +7. Use `Copy to Clipboard` or `Download ZIP`. |
50 | 42 |
|
51 | | -### 2. Run in source mode |
| 43 | + |
52 | 44 |
|
53 | | -macOS/Linux: |
| 45 | +## Queue / Batch Workflow |
54 | 46 |
|
55 | | -```bash |
56 | | -./start-client.sh |
57 | | -``` |
| 47 | +1. Use `Add Files` or `Add Folder`. |
| 48 | +2. Optional: set PDF page ranges (for example `1-3,5`). |
| 49 | +3. Click `Process Queue`. |
| 50 | +4. While running, you can `Pause`, `Cancel`, or `Retry Failed`. |
58 | 51 |
|
59 | | -Windows: |
| 52 | + |
60 | 53 |
|
61 | | -```bat |
62 | | -start-client.bat |
63 | | -``` |
| 54 | +## Basic vs Advanced Mode |
64 | 55 |
|
65 | | -### 3. In the app |
| 56 | +- `Basic`: minimal controls for fast OCR. |
| 57 | +- `Advanced`: full tuning, preflight checks, diagnostics export, retention policy. |
66 | 58 |
|
67 | | -1. Click `Load Model` (first time downloads model) |
68 | | -2. Drop/select an image or PDF |
69 | | -3. Click `Run OCR` |
| 59 | + |
| 60 | + |
70 | 61 |
|
71 | | -### Default model routing |
| 62 | +## Hardware Backends and Models |
72 | 63 |
|
73 | | -- Apple Silicon (MLX backend): `mlx-community/DeepSeek-OCR-2-8bit` |
74 | | -- CUDA + CPU (PyTorch backend): `deepseek-ai/DeepSeek-OCR-2` |
75 | | -- Override on any platform via `MODEL_NAME` |
| 64 | +The app routes by platform automatically: |
76 | 65 |
|
77 | | -## Queue Workflow |
| 66 | +| Platform / Device | Runtime Backend | Default Model | |
| 67 | +|---|---|---| |
| 68 | +| Apple Silicon (macOS arm64) | MLX (`mlx`, `mlx-vlm`) | [`mlx-community/DeepSeek-OCR-2-8bit`](https://huggingface.co/mlx-community/DeepSeek-OCR-2-8bit) | |
| 69 | +| NVIDIA CUDA (Windows/Linux) | PyTorch | [`deepseek-ai/DeepSeek-OCR-2`](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | |
| 70 | +| CPU fallback (Windows/Linux/Intel macOS) | PyTorch | [`deepseek-ai/DeepSeek-OCR-2`](https://huggingface.co/deepseek-ai/DeepSeek-OCR-2) | |
78 | 71 |
|
79 | | -- Add files or add a folder |
80 | | -- Optional PDF page range: `1-3,5` |
81 | | -- Click `Process Queue` |
82 | | -- Use queue controls while running: |
83 | | - - `Pause` |
84 | | - - `Resume` |
85 | | - - `Cancel` |
86 | | - - `Retry Failed` |
| 72 | +You can override the model with `MODEL_NAME` if needed. |
87 | 73 |
|
88 | | -Queue outputs are written under timestamped folders in the app cache output directory. |
| 74 | +## Reliability Features |
89 | 75 |
|
90 | | -## Basic vs Advanced Mode |
| 76 | +- First-run managed runtime setup with bundled `uv` |
| 77 | +- Hardware-aware environment provisioning |
| 78 | +- Startup status and preflight estimator |
| 79 | +- Diagnostics export (`ZIP`) |
| 80 | +- Retention policies for outputs/cache |
| 81 | +- Queue controls: pause/resume/cancel/retry |
91 | 82 |
|
92 | | -- `Basic`: simplified UI for common OCR flow |
93 | | -- `Advanced`: exposes tuning + diagnostics + retention controls |
| 83 | +## MCP Server (Codex / CLI / Other MCP Clients) |
94 | 84 |
|
95 | | -Mode is persisted locally. |
| 85 | +MCP server is included at `backend/mcp_server.py`. |
96 | 86 |
|
97 | | -## Preflight, Diagnostics, and Retention |
| 87 | +It supports: |
| 88 | +- model load |
| 89 | +- single OCR |
| 90 | +- queue add/status/process/pause/resume/cancel/retry |
| 91 | +- diagnostics export |
| 92 | +- retention policy operations |
98 | 93 |
|
99 | | -- `Run Preflight`: estimates required disk/download and expected setup time |
100 | | -- `Export Diagnostics`: writes a ZIP with app/backend diagnostics and log tails |
101 | | -- Retention policy panel: |
102 | | - - Output retention days |
103 | | - - Max queue run folders |
104 | | - - Download-cache retention days |
105 | | - - Optional cleanup on startup |
| 94 | +Quick reference and configs: |
| 95 | +- [`docs/mcp-server.md`](docs/mcp-server.md) |
106 | 96 |
|
107 | | -## Build Installers / Distributions |
| 97 | +## Build From Source |
108 | 98 |
|
109 | | -### Windows (NSIS) |
| 99 | +### Prerequisites |
110 | 100 |
|
111 | | -```powershell |
112 | | -powershell -ExecutionPolicy Bypass -File .\scripts\build-release.ps1 |
113 | | -``` |
| 101 | +- Node.js 18+ |
| 102 | +- Python 3.10-3.12 |
| 103 | +- Optional CUDA-capable NVIDIA GPU for CUDA acceleration |
114 | 104 |
|
115 | | -### macOS/Linux |
| 105 | +### Run in development |
116 | 106 |
|
117 | 107 | ```bash |
118 | | -bash ./scripts/build-release.sh |
| 108 | +npm ci |
| 109 | +./start-client.sh |
119 | 110 | ``` |
120 | 111 |
|
121 | | -### Manual dist commands |
| 112 | +Windows: |
122 | 113 |
|
123 | | -```bash |
124 | | -npm run dist:win |
125 | | -npm run dist:mac |
126 | | -npm run dist:linux |
| 114 | +```bat |
| 115 | +npm ci |
| 116 | +start-client.bat |
127 | 117 | ``` |
128 | 118 |
|
129 | | -## Testing |
130 | | - |
131 | | -### Electron E2E (mock backend) |
| 119 | +### Tests |
132 | 120 |
|
133 | 121 | ```bash |
134 | 122 | npm run test:e2e |
135 | | -``` |
136 | | - |
137 | | -### Host build smoke |
138 | | - |
139 | | -```bash |
140 | 123 | npm run test:build:smoke |
141 | | -``` |
142 | | - |
143 | | -### Host dist packaging |
144 | | - |
145 | | -```bash |
146 | 124 | npm run test:dist:host |
147 | 125 | ``` |
148 | 126 |
|
149 | | -## CI |
150 | | - |
151 | | -- `.github/workflows/ci-e2e.yml` |
152 | | - - E2E + build smoke on Linux/macOS/Windows |
153 | | -- `.github/workflows/dist-matrix.yml` |
154 | | - - Full host distribution packaging matrix (manual dispatch) |
| 127 | +### Build installers |
155 | 128 |
|
156 | | -## Security Model |
157 | | - |
158 | | -Renderer access is exposed through a restricted preload API: |
159 | | - |
160 | | -- `contextIsolation: true` |
161 | | -- `nodeIntegration: false` |
162 | | -- IPC channels wrapped by explicit preload methods |
163 | | - |
164 | | -## MCP Server (Codex/Claude/Any MCP Client) |
| 129 | +Windows: |
165 | 130 |
|
166 | | -This project includes an MCP (Model Context Protocol) server at `backend/mcp_server.py` that can drive the same OCR flows as the UI: single-file OCR, queue control, model loading, diagnostics, and retention management. |
| 131 | +```powershell |
| 132 | +powershell -ExecutionPolicy Bypass -File .\scripts\build-release.ps1 |
| 133 | +``` |
167 | 134 |
|
168 | | -**Codex App / Codex CLI quick start** |
| 135 | +macOS/Linux: |
169 | 136 |
|
170 | 137 | ```bash |
171 | | -cd /absolute/path/to/deepseek-ocr-client |
172 | | -codex mcp add deepseek-ocr --env DEEPSEEK_OCR_URL=http://127.0.0.1:5000 -- \ |
173 | | - "$(pwd)/venv/bin/python3" "$(pwd)/backend/mcp_server.py" |
174 | | -codex mcp list |
| 138 | +bash ./scripts/build-release.sh |
175 | 139 | ``` |
176 | 140 |
|
177 | | -**Claude Code quick start** |
178 | | - |
179 | | -- Project config: `.claude/mcp_servers.json` |
180 | | -- Optional plugin: `claude plugin install --path ./mcp-plugin` |
181 | | - |
182 | | -See [`docs/mcp-server.md`](docs/mcp-server.md) for full setup details, including Codex config snippets and troubleshooting. |
183 | | - |
184 | | -## Project Layout |
| 141 | +Manual distro commands: |
185 | 142 |
|
186 | | -- `main.js`: Electron main process, runtime bootstrap, IPC, setup flow |
187 | | -- `preload.js`: secure renderer bridge |
188 | | -- `renderer.js`: UI logic |
189 | | -- `backend/ocr_server.py`: Flask OCR backend + queue processing |
190 | | -- `backend/mcp_server.py`: MCP server for LLM integration |
191 | | -- `mcp-plugin/`: Claude Code plugin package |
192 | | -- `runtime/`: bundled `uv` binaries |
193 | | -- `scripts/`: release/test helpers |
194 | | -- `tests/e2e/`: Playwright E2E suite + mock backend |
195 | | -- `docs/`: analysis, testing strategy, and MCP documentation |
| 143 | +```bash |
| 144 | +npm run dist:win |
| 145 | +npm run dist:mac |
| 146 | +npm run dist:linux |
| 147 | +``` |
196 | 148 |
|
197 | 149 | ## Troubleshooting |
198 | 150 |
|
199 | | -- Model/setup issues: |
200 | | - - Run `Run Preflight` first, confirm disk/network are sufficient |
201 | | -- Runtime/setup anomalies: |
202 | | - - Export diagnostics and inspect `diagnostics.json` |
203 | | -- Queue stalls: |
204 | | - - Check queue state in UI (`paused`, `cancel requested`, failed items) |
205 | | - |
206 | | -## Upstream and Fork Context |
207 | | - |
208 | | -Original project: |
209 | | - |
| 151 | +- Setup stuck or failing: |
| 152 | + - Run `Run Preflight` |
| 153 | + - Check internet/disk availability |
| 154 | +- Model/runtime issues: |
| 155 | + - Use `Export Diagnostics` |
| 156 | + - Inspect `diagnostics.json` and log tails |
| 157 | +- Queue appears stalled: |
| 158 | + - Verify pause/cancel state |
| 159 | + - Retry failed items |
| 160 | + |
| 161 | +## Technical Notes |
| 162 | + |
| 163 | +- Electron main process: `main.js` |
| 164 | +- Secure renderer bridge: `preload.js` |
| 165 | +- UI logic: `renderer.js` |
| 166 | +- OCR backend: `backend/ocr_server.py` |
| 167 | +- MCP server: `backend/mcp_server.py` |
| 168 | +- E2E tests: `tests/e2e/` |
| 169 | +- CI workflows: `.github/workflows/` |
| 170 | + |
| 171 | +## Upstream/Fork Context |
| 172 | + |
| 173 | +Original upstream: |
210 | 174 | - [ihatecsv/deepseek-ocr-client](https://github.com/ihatecsv/deepseek-ocr-client) |
211 | 175 |
|
212 | | -This repository is an actively maintained fork focused on installer/runtime reliability and multi-platform operation. |
| 176 | +This repository is an actively maintained fork focused on production desktop workflows, hardware-aware runtime setup, and DeepSeek-OCR-2 integration. |
213 | 177 |
|
214 | 178 | ## License |
215 | 179 |
|
|
0 commit comments