Mistral OCR GUI Processor
A user-friendly desktop application, built with Python and Tkinter, to perform Optical Character Recognition (OCR) on images using the powerful Mistral AI API. The tool provides a simple interface to process individual images, entire folders, or nested subfolders, and can combine the extracted text into organized markdown files.
Features
- Intuitive Graphical User Interface: A clean, tabbed interface for different processing modes.
- Multiple Processing Modes:
- Individual Images: Process one or more specific image files.
- Folder Processing: Process all supported images within a single folder.
- Subfolder Processing: Process all supported images within the immediate subdirectories of a parent folder.
- Drag-and-Drop Support: Easily add files or folders by dragging them onto the application window.
- Markdown Combination: Automatically combine OCR results from multiple images into a single, well-structured markdown file.
- Flexible Sorting Options: When combining files, sort them by natural filename order or by modification date.
- Real-time Progress Visualization: A grid of squares visually represents the status of each image (Processing, Completed, Error).
- Cancellable Operations: Stop a long-running processing job at any time.
- Concurrent Processing: Uses a thread pool to process multiple images in parallel, speeding up large jobs.
Requirements
- Python 3.8 or higher.
- A Mistral AI account and an API key. You can get one from the Mistral AI Platform.
Installation
The recommended way to install the application is using pip:
pip install mistral-ocr-gui
This command will download the application and automatically install all required dependencies.
Installation from Source
If you want to contribute to the project or install the latest development version, you can install it from the source code:
-
Clone the repository:
git clone https://github.com/Danielnara24/Mistral-OCR.git cd Mistral-OCR
-
Install in editable mode: This command will install the application and its dependencies. The
-eflag allows you to make changes to the source code and have them take effect immediately.pip install -e .
Configuration: Setting the API Key
The application requires your Mistral API key to be set as an environment variable named MISTRAL_API_KEY.
Windows
Open Command Prompt or PowerShell and run the following command to set the variable permanently. You will need to restart your terminal for the change to take effect.
setx MISTRAL_API_KEY "your_api_key_here"
macOS / Linux
Add the following line to your shell's configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.profile):
export MISTRAL_API_KEY="your_api_key_here"
Then, either restart your terminal or run source ~/.bashrc (or the relevant file) to apply the changes.
Verify the Setup
You can verify that the environment variable is set correctly by running:
- (macOS/Linux):
echo $MISTRAL_API_KEY - (Windows CMD):
echo %MISTRAL_API_KEY% - (Windows PowerShell):
echo $env:MISTRAL_API_KEY
Usage
Once installed, the application can be launched directly from your terminal. Simply run the following command:
mistral-ocr
The graphical user interface will appear, and you can start processing your images.
How It Works
-
Select a Tab:
- Individual Images: Use this for processing a specific set of image files from different locations. Each image will generate a corresponding
_OCR.mdfile in its original directory. - Folder: Use this to process all images inside a single folder. You have the option to combine all the results into one markdown file named
Combined_OCR_[FolderName].md. - Subfolders: Use this to process images located in the immediate subfolders of a parent directory. You can combine results for each subfolder individually and even create a final compilation of all subfolder results.
- Individual Images: Use this for processing a specific set of image files from different locations. Each image will generate a corresponding
-
Add Files/Folders:
- Click the "Select..." button to open a file/folder dialog.
- Or, drag and drop your files/folders directly onto the application window.
-
Configure Settings (if applicable):
- For Folder and Subfolder modes, check the box to enable combining markdown files.
- Choose a sorting method for the combined document.
-
Process:
- Click the "Process" button to start the OCR job.
- The progress grid will update in real-time, showing the status of each file.
- A timer will show the elapsed time.
-
Output:
- The generated markdown files (
.md) will be saved in the same directory as the source images or in the relevant parent/subfolder directory for combined files.
- The generated markdown files (
License
This project is licensed under the MIT License.
Metadata
Release files for mistral-ocr-gui 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mistral_ocr_gui-0.4.0.tar.gz | 17.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mistral_ocr_gui-0.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 32.9 kB
Release files / mistral_ocr_gui-0.4.0.tar.gz
| Download URL | mistral_ocr_gui-0.4.0.tar.gz |
|---|---|
| Size | 17.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c892e59ace2e0c24104ba07b479b0fda7bdf519703f00f30b8f365c695bb7ada
|
|
BLAKE2b-256 checksum How to use checksums |
78c69ba5582574b4359482217237fe923e895b555fcf8afa4b630399bd501668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / mistral_ocr_gui-0.4.0-py3-none-any.whl
| Download URL | mistral_ocr_gui-0.4.0-py3-none-any.whl |
|---|---|
| Size | 15.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66297d04438a653a69504676b02aea0420dcc95f4fc0d49b0a5117bbf4d2fc5b
|
|
BLAKE2b-256 checksum How to use checksums |
04e25cc368110757ee9696ad5f4e459109aae088027a091ada9894cda7b84eb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Security for mistral-ocr-gui 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.