NashidulSarker/pulmonary-diagnostics-ai
1
Pulmonary Diagnostics AI ๐ซ
A web application designed for chest X-ray classification (Normal, COVID-19, Tuberculosis, and Viral Pneumonia) using a trained DenseNet-121 model. It uses OpenAI's CLIP model to validate that uploaded images are indeed chest X-rays before making predictions.
Running Locally
- Create a virtual environment and activate it:
python -m venv .venv
# Windows:
.\.venv\Scripts\Activate.ps1
# Linux/macOS:
source .venv/bin/activate- Install dependencies:
pip install -r requirements.txt- Launch the Gradio web app:
python gradio_app.pyDeploying to Hugging Face Spaces
This repository is pre-configured for deployment to Hugging Face Spaces.
Option A: Uploading via the Web UI (Easiest)
- Go to Hugging Face Spaces and click Create new Space.
- Give it a name, select Gradio as the SDK, and choose a free CPU basic tier (or GPU).
- Navigate to the Files tab in your new Space and click Add file -> Upload files.
- Drag and drop the following files/folders from your project:
gradio_app.pyrequirements.txtREADME.mdCNN_joint.pthModels/(entire directory)
Option B: Deploying via Git (Recommended for updates)
Since CNN_joint.pth is around 28 MB, you must use Git LFS (Large File Storage) when pushing via Git:
- Initialize Git and Git LFS:
git init
git lfs install
git lfs track "*.pth"
git add .gitattributes- Add your Hugging Face Space repository as a remote and push:
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
git add .
git commit -m "Initial commit with model and app"
git push -u origin main