A Deep Learning-based web application that detects Pneumonia from Chest X-Ray images using a Convolutional Neural Network (CNN) built with TensorFlow/Keras. The application provides an interactive clinical dashboard developed with Streamlit, displaying prediction probabilities, confidence scores, patient information, and downloadable AI-generated diagnostic reports.
Note: This project is intended for educational and research purposes only and is not a substitute for professional medical diagnosis.
-
π©» Chest X-Ray Classification
- Binary classification of Chest X-Ray images
- Detects:
- β Normal
- π¦ Pneumonia
-
π€ Deep Learning CNN
- Built using TensorFlow/Keras
- Image preprocessing and normalization
- Binary classification using Sigmoid activation
-
π Prediction Dashboard
- Prediction result
- Confidence score
- Normal probability
- Pneumonia probability
- Risk assessment
-
π€ Patient Information
- Patient Name
- Patient ID
- Age
- Gender
- Hospital
- Doctor
-
π Interactive Probability Chart
- Built using Plotly
- Displays prediction probabilities visually
-
π PDF Report Generation
- AI-generated diagnostic report
- Includes patient information
- Prediction summary
- Confidence score
- Probability values
- AI recommendation
-
π Modern Streamlit UI
- Responsive layout
- Dark theme
- Interactive dashboard
Chest X-Ray Image
β
βΌ
Image Preprocessing
β
βΌ
TensorFlow CNN Model
β
βΌ
Prediction
β
βΌ
Probability Analysis
β
βΌ
Risk Assessment
β
βΌ
PDF Report Generation
Pneumonia-Detection-AI/
β
βββ app.py
βββ README.md
βββ requirements.txt
βββ x_ray.ipynb
βββ .gitignore
β
βββ assets/
β βββ dashboard.png
β βββ prediction.png
β βββ analytics.png
β βββ report.png
β
βββ utils/
β βββ helpers.py
β βββ preprocess.py
β βββ predict.py
β βββ report.py
β
βββ LICENSE
If
pneumonia_model.kerasis not included, download it separately and place it in the project root.
- TensorFlow
- Keras
- OpenCV
- Pillow (PIL)
- Streamlit
- Plotly
- Matplotlib
- NumPy
- Pandas
- ReportLab
Input Image (224 Γ 224 Γ 3)
β
βΌ
Conv2D (32 Filters)
β
βΌ
MaxPooling2D
β
βΌ
Conv2D (64 Filters)
β
βΌ
MaxPooling2D
β
βΌ
Flatten
β
βΌ
Dense (128 Units)
β
βΌ
Dense (1 Unit - Sigmoid)
β
βΌ
Prediction
The model predicts:
| Prediction | Description |
|---|---|
| Normal | Chest X-Ray appears normal |
| Pneumonia | Features associated with pneumonia detected |
The application also displays:
- Confidence Score
- Normal Probability
- Pneumonia Probability
- Risk Level
- AI Recommendation
The model was trained using a labelled Chest X-Ray image dataset containing two classes:
- Normal
- Pneumonia
All images are resized to:
224 Γ 224 Γ 3
before inference.
git clone https://github.com/Shaipratt51/Pneumonia-Detection-AI.gitcd Pneumonia-Detection-AIpython -m venv venv
venv\Scripts\activatepython3 -m venv venv
source venv/bin/activatepip install -r requirements.txtstreamlit run app.pyThe application will open at:
http://localhost:8501
- Launch the Streamlit application.
- Enter patient information.
- Upload a Chest X-Ray image.
- Wait for the model prediction.
- Review:
- Prediction
- Confidence
- Probability chart
- Risk level
- AI recommendation
- Download the generated PDF report.
- Patient Details
- Hospital Information
- Doctor Name
- Prediction
- Confidence Score
- Normal Probability
- Pneumonia Probability
- Risk Level
- AI Recommendation
tensorflow
streamlit
opencv-python
numpy
pandas
matplotlib
plotly
pillow
reportlab
Install using:
pip install -r requirements.txt- Multi-class lung disease detection
- Tuberculosis detection
- COVID-19 detection
- DICOM image support
- Cloud deployment
- User authentication
- Patient history management
- Model monitoring dashboard
The model uses:
- Convolutional Neural Network (CNN)
- Binary Cross-Entropy Loss
- Adam Optimizer
- Sigmoid Activation
Evaluation metrics include:
- Accuracy
- Prediction Probability
- Confidence Score
The trained model (pneumonia_model.keras) may not be included in this repository because it exceeds GitHub's file size limit.
If unavailable, place the trained model file in the project root:
Pneumonia-Detection-AI/
β
βββ pneumonia_model.keras
This project is intended solely for educational and research purposes.
The predictions generated by this AI system should NOT be considered a medical diagnosis or used as a substitute for professional medical advice, diagnosis, or treatment.
Always consult a qualified physician or radiologist for clinical decisions.



