|
1 | | -# DocGPT |
| 1 | +# DocGPT (Doctor GPT) - AI-Powered Medical Diagnosis System |
| 2 | + |
| 3 | +DocGPT (Doctor GPT) is an advanced medical diagnosis system that combines Vision Transformer (ViT) based deep learning models with LangChain agents to provide comprehensive medical image analysis and detailed diagnostic reports. The system leverages the power of PyTorch for deep learning and Groq's LLM for generating human-like medical insights. |
| 4 | + |
| 5 | +## Core Technology |
| 6 | + |
| 7 | +- **LangChain Agents**: Intelligent agents that coordinate between different disease detection models and the LLM to provide comprehensive medical analysis |
| 8 | +- **Vision Transformer (ViT)**: State-of-the-art transformer architecture for medical image analysis |
| 9 | +- **Deep Learning Models**: Specialized PyTorch models trained for different medical conditions: |
| 10 | + - ResNet-based architecture for Eye Disease detection |
| 11 | + - Vision Transformer for Skin Cancer classification |
| 12 | + - Custom CNN architecture for Pneumonia detection |
| 13 | + |
| 14 | +## Features |
| 15 | + |
| 16 | +- **Multi-Disease Detection**: Supports multiple medical conditions: |
| 17 | + - Eye Diseases (Cataract, Glaucoma, Diabetic Retinopathy) |
| 18 | + - Skin Cancer (Melanoma Detection) |
| 19 | + - Pneumonia (X-ray Analysis) |
| 20 | + - Brain Tumor (Coming Soon) |
| 21 | + - Heart Disease (Coming Soon) |
| 22 | + |
| 23 | +- **AI-Powered Analysis**: |
| 24 | + - Deep learning models for accurate disease detection |
| 25 | + - Groq LLM integration for detailed medical reports |
| 26 | + - LangChain agents for orchestrating the analysis pipeline |
| 27 | + |
| 28 | +- **Modern Architecture**: |
| 29 | + - FastAPI backend with automatic OpenAPI documentation |
| 30 | + - Streamlit frontend for testing (React.js interface planned) |
| 31 | + - Modular design for easy extension to new disease types |
| 32 | + |
| 33 | +## Tech Stack |
| 34 | + |
| 35 | +- **Backend Framework**: FastAPI |
| 36 | +- **Deep Learning**: |
| 37 | + - PyTorch |
| 38 | + - torchvision |
| 39 | + - Vision Transformer (ViT) |
| 40 | +- **AI Integration**: |
| 41 | + - LangChain for agent orchestration |
| 42 | + - Groq API for medical report generation |
| 43 | +- **Image Processing**: |
| 44 | + - PIL |
| 45 | + - torchvision transforms |
| 46 | +- **Development**: |
| 47 | + - Python 3.12+ |
| 48 | + - pydantic for data validation |
| 49 | + - uvicorn for ASGI server |
| 50 | + |
| 51 | +## Installation |
| 52 | + |
| 53 | +1. Clone the repository: |
| 54 | +```bash |
| 55 | +git clone https://github.com/codewithdark-git/DocGPT.git |
| 56 | +cd DocGPT |
| 57 | +``` |
| 58 | + |
| 59 | +2. Create and activate a virtual environment: |
| 60 | +```bash |
| 61 | +python -m venv venv |
| 62 | +source venv/bin/activate # Linux/Mac |
| 63 | +# OR |
| 64 | +venv\Scripts\activate # Windows |
| 65 | +``` |
| 66 | + |
| 67 | +3. Install dependencies: |
| 68 | +```bash |
| 69 | +pip install -r requirements.txt |
| 70 | +``` |
| 71 | + |
| 72 | +4. Set up environment variables in `.env`: |
| 73 | +```env |
| 74 | +GROQ_API_KEY=your_groq_api_key |
| 75 | +GROQ_MODEL_NAME=llama-3.2-11b-vision-preview |
| 76 | +``` |
| 77 | + |
| 78 | +## Usage |
| 79 | + |
| 80 | +1. Start the FastAPI backend: |
| 81 | +```bash |
| 82 | +uvicorn app.main:app --reload |
| 83 | +``` |
| 84 | + |
| 85 | +2. Start the Streamlit frontend (in a new terminal): |
| 86 | +```bash |
| 87 | +streamlit run streamlit_app.py |
| 88 | +``` |
| 89 | + |
| 90 | +3. Access the applications: |
| 91 | +- API Documentation: http://localhost:8000/docs |
| 92 | +- Streamlit Interface: http://localhost:8501 |
| 93 | + |
| 94 | +## API Endpoints |
| 95 | + |
| 96 | +### Health Check |
| 97 | +- `GET /api/v1/health`: Check API health status |
| 98 | + |
| 99 | +### Disease Prediction |
| 100 | +- `POST /api/v1/predict`: Submit an image for disease prediction |
| 101 | + - Parameters: |
| 102 | + - `disease_type`: Type of disease to predict |
| 103 | + - `file`: Image file |
| 104 | + |
| 105 | +## Model Testing |
| 106 | + |
| 107 | +Test individual models using the provided test scripts: |
| 108 | + |
| 109 | +```bash |
| 110 | +# Test Eye Disease Model |
| 111 | +python test_eye.py path/to/eye/image.jpg |
| 112 | +``` |
| 113 | + |
| 114 | +## Project Structure |
| 115 | + |
| 116 | +``` |
| 117 | +DocGPT/ |
| 118 | +├── app/ |
| 119 | +│ ├── main.py # FastAPI application |
| 120 | +│ ├── config.py # Configuration settings |
| 121 | +│ ├── routers/ # API routes |
| 122 | +│ ├── schemas/ # Pydantic models |
| 123 | +│ └── services/ # ML models and business logic |
| 124 | +├── models/ # Trained model files |
| 125 | +├── streamlit_app.py # Streamlit frontend |
| 126 | +├── requirements.txt # Project dependencies |
| 127 | +└── .env # Environment variables |
| 128 | +``` |
| 129 | + |
| 130 | +## Disease Types |
| 131 | + |
| 132 | +- **Eye Disease Detection**: |
| 133 | + - Normal |
| 134 | + - Cataract |
| 135 | + - Glaucoma |
| 136 | + - Diabetic Retinopathy |
| 137 | + |
| 138 | +- **Skin Cancer Detection**: |
| 139 | + - Melanoma |
| 140 | + - Non-Melanoma |
| 141 | + |
| 142 | +- **Pneumonia Detection**: |
| 143 | + - Normal |
| 144 | + - Pneumonia |
| 145 | + |
| 146 | +## Contributing |
| 147 | + |
| 148 | +1. Fork the repository |
| 149 | +2. Create a feature branch |
| 150 | +3. Commit your changes |
| 151 | +4. Push to the branch |
| 152 | +5. Create a Pull Request |
| 153 | + |
| 154 | +## License |
| 155 | + |
| 156 | +This project is licensed under the MIT License - see the LICENSE file for details. |
| 157 | + |
| 158 | +## Acknowledgments |
| 159 | + |
| 160 | +- Medical datasets providers |
| 161 | +- PyTorch team |
| 162 | +- Groq API team |
| 163 | +- FastAPI and Streamlit communities |
2 | 164 |
|
0 commit comments