File size: 1,849 Bytes
e275025
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# 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`.