Metadata-Version: 2.4
Name: MediTranslate
Version: 1.0.3
Summary: A simple, private, and offline medical translation tool.
Requires-Python: >=3.14
Requires-Dist: google-genai>=1.52.0
Requires-Dist: google>=3.0.0
Requires-Dist: loguru>=0.7.3
Requires-Dist: numpy>=2.3.5
Requires-Dist: opencv-python>=4.11.0.86
Requires-Dist: pdf2image>=1.17.0
Requires-Dist: pillow>=12.0.0
Requires-Dist: pyinstaller>=6.17.0
Requires-Dist: pyside6>=6.10.1
Requires-Dist: pytesseract>=0.3.13
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: reportlab>=4.4.5
Requires-Dist: sacremoses>=0.1.1
Requires-Dist: safetensors>=0.7.0
Requires-Dist: sentencepiece>=0.2.1
Requires-Dist: torch>=2.9.1
Requires-Dist: transformers>=4.57.1
Description-Content-Type: text/markdown

# MediTranslate:

**MediTranslate** is a private, offline-first medical translation tool designed to help patients understand complex medical documents.

It combines **local machine translation** (for privacy) with **cloud-based AI** (for simplification), allowing users to scan documents, translate them into their native language, and get simple, jargon-free explanations.

---

## Features:

* **Privacy First:** OCR and Translation run entirely **offline** on your device. No patient data leaves your computer during the basic translation process.
* **OCR:** Auto-detects text from scanned PDFs or images using Tesseract and OpenCV.
* **Hybrid AI:**
    * **Local:** Uses `MarianMT` (Transformers) for accurate, private translation.
    * **Cloud (Optional):** Uses Google Gemini to "explain like I'm 5" for difficult medical terms (requires API key).
* **Medical Glossary:** Built-in database of 70,000+ medical terms and ICD-10 codes.
* **Cross-Platform:** Works on Windows, macOS, and Linux.

When the user runs the app, it will do the following before runtime: 
1. check for models in the `resources/models` directory. If they are not found, it will download them.
2. load glossaries and read the JSON files. 
3. check API key in the `.env` file on root directory. If it is not found, it will prompt the user to manually enter it.

---

## Installation:

### Windows:

#### Step 1: Install Tesseract OCR:

1.  Download the installer from the [Tesseract Wiki](https://github.com/UB-Mannheim/tesseract/wiki).
2.  Run the installer.
3.  **CRITICAL:** During installation, you will see an option for language data. Ensure you check the boxes for languages you plan to scan (e.g., Spanish, Hindi).
4.  **CRITICAL:** Once installed, you must add Tesseract to your System PATH:
    * Press `Win` key, type **"Edit the system environment variables"**, and hit Enter.
    * Click the **"Environment Variables"** button.
    * Under **"System variables"** (bottom box), find the row named **"Path"** and double-click it.
    * Click **"New"** and paste this path: `C:\Program Files\Tesseract-OCR`
    * Click OK on all windows.

#### Step 2: Install uv:
1.  Open **PowerShell**.
2.  Paste this command and press Enter:
    ```powershell
    powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
    ```
3.  Close PowerShell and open it again to refresh.

#### Step 3: Install MediTranslate
1.  In the new PowerShell window, run:
    ```powershell
    uv tool install meditranslate
    ```
2.  Once finished, you can run the app by typing:
    ```powershell
    meditranslate
    ```
---

### macOS:

#### Step 1: Install Homebrew (if you haven't already):
1.  Open **Terminal**.
2.  Paste this and hit Enter (follow the prompts on screen):
    ```bash
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    ```

#### Step 2: Install Tesseract
1.  In the Terminal, run:
    ```bash
    brew install tesseract
    brew install tesseract-lang
    ```

#### Step 3: Install `uv`:
1.  Install `uv`:
    ```bash
    curl -LsSf https://astral.sh/uv/install.sh | sh
    ```
2.  **Close your Terminal and open a new one.**
3.  Install the app:
    ```bash
    uv tool install meditranslate
    ```
4.  Run it:
    ```bash
    meditranslate
    ```

---

### Linux (Debian/Ubuntu):

#### Step 1: Install Dependencies:
1.  Open **Terminal**.
2.  Run the following commands:
    ```bash
    sudo apt-get update
    sudo apt-get install -y tesseract-ocr tesseract-ocr-all libgl1
    ```

#### Step 2: Install `uv`:
1.  Paste this command into your terminal and hit Enter:
    ```bash
    curl -LsSf https://astral.sh/uv/install.sh | sh
    ```
2.  **Close your terminal window and open a new one**

#### Step 3: Install MediTranslate
1.  In the new terminal window, run:
    ```bash
    uv tool install meditranslate
    ```
2.  Once finished, you can run the app by typing:
    ```bash
    meditranslate
    ```

---

### Linux (Arch/Manjaro):

#### Step 1: Install Dependencies:
1.  Open **Terminal**.
2.  Run the following command (installs Tesseract, language data, and graphics libraries):
    ```bash
    sudo pacman -Syu tesseract tesseract-data-eng tesseract-data-spa tesseract-data-hin libglvnd
    ```

#### Step 2: Install `uv`:
1.  Arch Linux includes `uv` in the official repositories. Run this command:
    ```bash
    sudo pacman -S uv
    ```
2.  **Close your terminal window and open a new one**

#### Step 3: Install MediTranslate
1.  In the new terminal window, run:
    ```bash
    uv tool install meditranslate
    ```
2.  Once finished, you can run the app by typing:
    ```bash
    meditranslate
    ```
---

## AI Assistant

### Step 1: Get API Key
1.  Go to [Google AI Studio](https://aistudio.google.com/api-keys) and sign in.
2.  Click on **"Create API Key"**.
3.  Name your key, then name your project (create a new one).
4.  Create a `.env` file in your root directory (not project root).
5.  Add the API key to the `.env` file:
    ```
    GEMINI_API_KEY=your_api_key_here
    ```

---

## Uninstalling

If you wish to remove MediTranslate from your system, follow these steps:

### 1. Remove the Application
Run this command in your Terminal or PowerShell to uninstall the tool:
```bash
uv tool uninstall meditranslate
```

