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 …