| # Windows Packaging (uv + PyInstaller) | |
| This guide builds a single-file `.exe` for the Trans-for-Doctors CLI using uv and PyInstaller. | |
| ## Prerequisites | |
| - Windows 10/11 | |
| - Python 3.10+ installed | |
| - uv installed (https://docs.astral.sh/uv/) | |
| - Adequate disk space (bundling `torch`/`transformers` + model can be several GB) | |
| ## Install dependencies with uv | |
| ```bash | |
| uv pip install . | |
| uv pip install .[llm] | |
| uv pip install pyinstaller | |
| ``` | |
| If you use CUDA builds of `torch`, ensure matching CUDA runtime is installed. | |
| ## Build single-file exe | |
| Build the CLI `app/main.py` as a single executable named `TransForDoctors.exe`. | |
| ```bash | |
| uv run pyinstaller \ | |
| --onefile \ | |
| --name TransForDoctors \ | |
| app/main.py \ | |
| --add-data "config.json;." \ | |
| --add-data "tokenizer_config.json;." \ | |
| --add-data "preprocessor_config.json;." \ | |
| --add-data "normalizer.json;." \ | |
| --add-data "special_tokens_map.json;." \ | |
| --add-data "added_tokens.json;." \ | |
| --add-data "merges.txt;." \ | |
| --add-data "vocab.json;." \ | |
| --add-data "medical_terms.txt;." | |
| ``` | |
| Notes: | |
| - `--add-data` pairs use `SRC;DEST` with `;` on Windows. | |
| - Including `model.safetensors` will produce a very large binary; you can omit it and place the model files next to the `.exe` under the same directory if preferred. | |
| ## Running | |
| Place `TransForDoctors.exe` alongside the model files (if not embedded) and run: | |
| ```bash | |
| ./TransForDoctors.exe \ | |
| --audio path\\to\\dictation.wav \ | |
| --model . \ | |
| --terms medical_terms.txt \ | |
| --llm \ | |
| --openai-key %OPENAI_API_KEY% \ | |
| --save-original --save-corrected --generate-report | |
| ``` | |
| ## Troubleshooting | |
| - Missing CUDA DLLs: use CPU (`--device cpu`) or install matching CUDA runtime. | |
| - Large binary size: omit `--add-data model.safetensors` and keep model files next to the exe. | |
| - OpenAI key: set environment variable `OPENAI_API_KEY` or pass `--openai-key`. | |