DocGPT (Doctor GPT) - AI-Powered Medical Diagnosis System

Ahsan Umar

DocGPT (Doctor GPT) - AI-Powered Medical Diagnosis System

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.

Core Technology

LangChain Agents: Intelligent agents that coordinate between different disease detection models and the LLM to provide comprehensive medical analysis
Vision Transformer (ViT): State-of-the-art transformer architecture for medical image analysis
Deep Learning Models: Specialized PyTorch models trained for different medical conditions:
ResNet-based architecture for Eye Disease detection
Vision Transformer for Skin Cancer classification
Custom CNN architecture for Pneumonia detection

Features

Multi-Disease Detection: Supports multiple medical conditions:
Eye Diseases (Cataract, Glaucoma, Diabetic Retinopathy)
Skin Cancer (Melanoma Detection)
Pneumonia (X-ray Analysis)
Brain Tumor (Coming Soon)
Heart Disease (Coming Soon)
AI-Powered Analysis:
Deep learning models for accurate disease detection
Groq LLM integration for detailed medical reports
LangChain agents for orchestrating the analysis pipeline
Modern Architecture:
FastAPI backend with automatic OpenAPI documentation
Streamlit frontend for testing (React.js interface planned)
Modular design for easy extension to new disease types

Tech Stack

Backend Framework: FastAPI
Deep Learning:
PyTorch
torchvision
Vision Transformer (ViT)
AI Integration:
LangChain for agent orchestration
Groq API for medical report generation
Image Processing:
PIL
torchvision transforms
Development:
Python 3.12+
pydantic for data validation
uvicorn for ASGI server

Installation

Clone the repository:
git clone https://github.com/codewithdark-git/DocGPT.git
cd DocGPT
Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
# OR
venv\Scripts\activate # Windows
Install dependencies:
pip install -r requirements.txt
Set up environment variables in .env:
GROQ_API_KEY=your_groq_api_key
GROQ_MODEL_NAME=llama-3.2-11b-vision-preview

Usage

Start the FastAPI backend:
uvicorn app.main:app --reload
Start the Streamlit frontend (in a new terminal):
streamlit run streamlit_app.py
Access the applications:
API Documentation: http://localhost:8000/docs
Streamlit Interface: http://localhost:8501

API Endpoints

Health Check

GET /api/v1/health: Check API health status

Disease Prediction

POST /api/v1/predict: Submit an image for disease prediction
Parameters:
disease_type: Type of disease to predict
file: Image file

Project Structure

DocGPT/
├── app/
│ ├── main.py # FastAPI application
│ ├── config.py # Configuration settings
│ ├── routers/ # API routes
│ ├── schemas/ # Pydantic models
│ └── services/ # ML models and business logic
├── models/ # Trained model files
├── streamlit_app.py # Streamlit frontend
├── requirements.txt # Project dependencies
└── .env # Environment variables

Disease Types

Eye Disease Detection:
Normal
Cataract
Glaucoma
Diabetic Retinopathy
Skin Cancer Detection:
Melanoma
Non-Melanoma
Pneumonia Detection:
Normal
Pneumonia

Contributing

Fork the repository
Create a feature branch
Commit your changes
Push to the branch
Create a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Medical datasets providers
PyTorch team
Groq API team
FastAPI and Streamlit communities
Like this project
0

Posted Feb 4, 2025

DocGPT (Doctor GPT) is an advanced medical diagnosis system that combines Vision Transformer (ViT) based deep learning models with LangChain agents to provide …