chest-xray-diagnosis
v1.0.1
Published
AI-powered chest X-ray diagnostic assistant — auto-installs the Python backend and launches the API server via npx.
Maintainers
Readme
chest-xray-diagnosis (NPM)
An AI-powered medical diagnostic system for chest X-ray analysis, designed to be launched instantly via NPM.
This is a Node.js wrapper around the Python chest-xray-diagnosis package. It gives front-end and Node developers zero-config access to a powerful PyTorch X-ray diagnostic backend.
🚀 Quick Start (Zero Config)
Run the API server instantly:
npx chest-xray-diagnosis serve --port 8000What happens under the hood?
- Detects if you have Python 3.9+ installed.
- Automatically creates an isolated virtual environment at
~/.chexray-diagnosis/venv/. - Installs the core Python machine learning libraries (PyTorch, FastAPI, etc.).
- Downloads the pre-trained X-ray model weights (~230 MB) from HuggingFace Hub.
- Launches the REST API server!
📋 Prerequisites
- Node.js 16+
- Python 3.9+ installed on your system
- (Optional) API Keys:
- Gemini API Key (for AI clinical explanations)
- Geoapify API Key (for nearby doctor search)
Note: The core ML analysis (disease detection & heatmaps) works 100% locally without any API keys!
💻 CLI Commands
You can use npx to run any of the underlying CLI commands:
Start the API Server
npx chest-xray-diagnosis serve --port 8000Configure API Keys (Interactive Wizard)
npx chest-xray-diagnosis setupSecurely saves your API keys so the local server can use Gemini and Geoapify.
Pre-Download Models
npx chest-xray-diagnosis download-modelsManually downloads the PyTorch model weights to your local cache.
Analyze a Single Image from Terminal
npx chest-xray-diagnosis analyze path/to/xray.png🧠 What it does
When an image is sent to the server, it runs through a powerful 4-stage pipeline:
- Binary Pipeline: Validates the image (is it garbage? is it a chest?).
- CheXNet (DenseNet-121): Detects 14 different lung pathologies (Pneumonia, Mass, Effusion, etc.).
- Grad-CAM++: Generates a visual heatmap (returned as base64) highlighting the diseased areas of the lung.
- Gemini AI: Generates a patient-friendly clinical explanation of the findings.
License & Disclaimer
MIT License.
Medical Disclaimer: For research and educational use only. Not a substitute for professional medical diagnosis. Always consult a qualified healthcare provider.
