Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🫁 PneumoScan AI — Pneumonia Detection System

Full-stack Flask web app for chest X-ray pneumonia detection using ResNet-50 + FastAI.

Project Structure

pneumonia_app/
├── app.py                  ← Flask backend
├── requirements.txt        ← Python dependencies
├── templates/
│   └── index.html          ← Full frontend UI
└── static/
    └── uploads/            ← Uploaded X-ray images

Quick Start

1. Install dependencies

pip install -r requirements.txt

2. Run the app

python app.py

3. Open browser

http://localhost:5000

Add Real Model (Optional)

Install FastAI

pip install fastai

Train the model

from fastai.vision.all import *

# Load Kaggle dataset
path = Path('chest_xray')
dls = ImageDataLoaders.from_folder(
    path, valid='val',
    item_tfms=Resize(224),
    batch_tfms=aug_transforms()
)

# Train ResNet-50
learn = vision_learner(dls, resnet50, metrics=accuracy)
learn.fine_tune(5)
learn.export('pneumonia_model.pkl')

Update app.py

Replace the mock_predict() function with:

from fastai.vision.all import load_learner, PILImage

learn = load_learner('pneumonia_model.pkl')

def real_predict(filepath):
    img = PILImage.create(filepath)
    pred, pred_idx, probs = learn.predict(img)
    return str(pred), float(probs[pred_idx])

Features

  • Drag & drop X-ray upload
  • 3-class classification: Normal / Bacterial / Viral Pneumonia
  • Confidence score with animated ring chart
  • Grad-CAM heatmap overlay
  • Probability bars for all classes
  • ICD-10 code mapping
  • Patient ID tracking
  • Clinical recommendation
  • Analysis history
  • Downloadable clinical report
  • HIPAA-aware pipeline design

Dataset

Kaggle: Chest X-Ray Images (Pneumonia)

  • 5,856 images | 3 classes | Train/Val/Test split

Tech Stack

  • Backend: Python, Flask
  • AI Model: FastAI v2, ResNet-50, PyTorch
  • Explainability: Grad-CAM
  • Frontend: Vanilla HTML/CSS/JS (no framework needed)

About

Full-stack AI diagnostic tool — ResNet-50 chest X-ray classifier with Grad-CAM explainability, Flask REST API, and HIPAA-aware confidence thresholding

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages