Spaces:
Runtime error
Runtime error
| title: OJOS AI | |
| emoji: ποΈ | |
| colorFrom: green | |
| colorTo: blue | |
| sdk: docker | |
| app_port: 7860 | |
| pinned: false | |
| # ποΈ OJOS AI β Advanced Eye Disease Detection Web App | |
| A state-of-the-art deep learning web application that detects and classifies multiple eye diseases with **96.69% validation accuracy** using fine-tuned Convolutional Neural Networks (CNNs). Equipped with a premium glassmorphic dark-mode UI. | |
| --- | |
| ## π― Key Features | |
| - **Multi-Disease Classification**: Detects 5 distinct conditions: | |
| - ποΈ **Cataract** | |
| - β οΈ **Diabetic Retinopathy** | |
| - π΄ **Glaucoma** | |
| - π **Myopia** | |
| - β **Healthy Eye** | |
| - **High Performance**: Achieves **96.69% accuracy** on clinical validation datasets. | |
| - **Advanced Preprocessing**: Uses LAB color space **CLAHE (Contrast Limited Adaptive Histogram Equalization)** to enhance contrast in retinal/eye images, matching clinical standards. | |
| - **Premium User Interface**: Dark glassmorphic theme with sliding login/signup panel, drag-and-drop upload, scanning progress animation, and multi-probability confidence charts. | |
| - **Robust Authentication**: Fully integrated SQLite database system for secure user registration and login session management. | |
| - **Keras 3 Runtime Compatibility**: Includes a custom monkeypatch to bypass quantization config parameters when loading legacy `.h5` model files. | |
| --- | |
| ## π οΈ Tech Stack | |
| - **Backend**: Python, Flask, SQLite3 | |
| - **Deep Learning**: TensorFlow / Keras (EfficientNetV2 backbone) | |
| - **Computer Vision**: OpenCV, Pillow (PIL) | |
| - **Frontend**: HTML5, Vanilla CSS3 (Glassmorphism, Neon Accents, CSS Keyframes) | |
| - **Deployment**: Docker, Hugging Face Spaces (Git LFS) | |
| --- | |
| ## π How to Run Locally | |
| ### 1. Prerequisites | |
| Ensure you have Python 3.9+ installed. Install the required libraries: | |
| ```bash | |
| pip install tensorflow opencv-python numpy pillow flask | |
| ``` | |
| ### 2. Clone the Repository | |
| ```bash | |
| git clone https://github.com/Sharad9084/OJOS-AI.git | |
| cd OJOS-AI | |
| ``` | |
| ### 3. Run the Application | |
| ```bash | |
| python app.py | |
| ``` | |
| Open [http://localhost:5000](http://localhost:5000) in your web browser. | |
| --- | |
| ## π Project Structure | |
| ``` | |
| OJOS-AI/ | |
| βββ best_eye_disease_model.h5 # Fine-tuned EfficientNetV2 multiclass model (Git LFS) | |
| βββ class_indices.json # Mapping of class names to model indices | |
| βββ app.py # Core Flask server and prediction pipeline | |
| βββ database.py # SQLite database utility functions | |
| βββ requirements.txt # Python dependencies | |
| βββ Dockerfile # Containerization config for Hugging Face Spaces | |
| βββ Procfile # Web process config | |
| βββ static/ | |
| β βββ css/ | |
| β β βββ style.css # Premium glassmorphic styling sheet | |
| β βββ logo.png # Custom circular eye logo | |
| β βββ uploads/ # Directory for temporary preview images | |
| βββ templates/ | |
| βββ home.html # Main landing page | |
| βββ login.html # Login & signup portal | |
| βββ prediction.html # Real-time scan and multi-probability results | |
| βββ about.html # Team / info page | |
| βββ diseases_info.html # Visual medical encyclopedia | |
| ``` | |
| --- | |
| ## π‘ How It Works | |
| ### 1. Image Preprocessing & Contrast Enhancement | |
| Retinal images can have inconsistent illumination. To normalize this: | |
| - The input image is converted to the **LAB color space**. | |
| - **CLAHE** is applied on the L-channel (lightness) to enhance local contrast without over-amplifying noise. | |
| - The image is merged back, converted to RGB, and resized to **300x300**. | |
| - EfficientNetV2 normalization (`preprocess_input`) is applied. | |
| ### 2. Inference & Classification | |
| - The preprocessed image is passed into `best_eye_disease_model.h5`. | |
| - The model outputs logits/probabilities for all 5 target categories. | |
| - The front-end renders a interactive bar chart displaying the confidence percentage for every condition. | |
| --- | |
| ## βοΈ Medical Compliance & Disclaimer | |
| - **Screening Tool Only**: This application is designed as an assistive screening tool. It does not replace professional medical diagnosis, advice, or treatment by a qualified ophthalmologist. | |
| - **Data Privacy**: Images uploaded are saved temporarily on the server for visualization and are not shared. | |
| --- | |
| ## π Contact & Support | |
| Developed by **Sharad Sharma** (sharmasharad9794@gmail.com). | |
| β **If you found this project helpful, please star the repository!** | |