Tunisian Passport OCR
# πΉπ³ MEDTOUR - Tunisian Passport OCR System
AI-powered Tunisian Passport OCR system built for **MEDTOUR Travel Agency**. Fine-tunes the Chhagan_ML-VL-OCR-v1 model (Qwen2.5-VL-3B + LoRA) on annotated Tunisian passport images.
## β¨ Features
- π **17 Field Extraction**: Surname, given names, DOB, expiry, MRZ, Arabic fields, and more
- π **Bilingual**: Extracts both Latin and Arabic text fields
- β‘ **FastAPI Backend**: RESTful API with Swagger documentation
- π¨ **Premium UI**: Beautiful dark-themed MEDTOUR frontend
- π¦ **Batch Processing**: Process multiple passports at once
- π **Export**: Copy JSON / Download CSV
- π€ **Demo Mode**: Test the UI without loading the ML model
## π Project Structure
```
tunisian-passport-ocr-2/
βββ visa/ # 68 passport images + Label Studio annotations
βββ data/
β βββ prepare_dataset.py # Convert annotations to training format
β βββ dataset/ # Processed train/val JSON files
βββ training/
β βββ config.yaml # Training configuration
β βββ train.py # Local fine-tuning script
β βββ train_colab.py # Google Colab training (recommended)
βββ model/ # Saved fine-tuned LoRA adapter
βββ api/
β βββ main.py # FastAPI application
β βββ ocr_engine.py # Model inference engine
β βββ schemas.py # Pydantic data models
β βββ requirements.txt # API dependencies
βββ frontend/
β βββ index.html # MEDTOUR web interface
β βββ index.css # Dark theme styles
β βββ app.js # Frontend logic
βββ run_api.py # Quick-start server script
βββ requirements.txt # All dependencies
```
## π Quick Start
### 1. Install Dependencies
```bash
pip install -r requirements.txt
```
### 2. Prepare Dataset (from Label Studio annotations)
```bash
python data/prepare_dataset.py
```
### 3. Start API Server (Demo Mode)
```bash
# Demo mode (no model loaded - for UI testing)
set SKIP_MODEL_LOAD=1
pyth β¦