An end-to-end Flask-based AI application that classifies wound images using a EfficientNet (TensorFlow) and provides grounded medical guidance using RAG (Retrieval-Augmented Generation).
Dataset Link - https://drive.google.com/drive/folders/1vgbEtBshfLRfwxig2wKiTb3mss5_PQt2?usp=sharing
Model Link - https://drive.google.com/file/d/1bzTvevRJpmOdZ8VDCxPOG6pu_Flsdo4n/view?usp=sharing
The application utilizes a modular AI pipeline:
- Vision Pipeline: Processes image uploads through a TensorFlow CNN to identify 8 specific wound classes.
- RAG Pipeline: Uses LangChain and ChromaDB to retrieve context from trusted medical PDFs.
- Inference Engine: Generates safe, non-hallucinated responses via a local Ollama LLM.
| Layer | Technology | Role |
|---|---|---|
| Backend | Flask | API Orchestration & Routing |
| ML Model | TensorFlow | CNN-based Image Classification |
| RAG Framework | LangChain | Knowledge Retrieval Logic |
| Vector DB | Chroma | Semantic Search & Embeddings |
| Containerization | Docker | Environment Isolation & Portability |
| LLM | Ollama | Local Inference (LlamaMedicine) |
- Abrasions
- Bruises
- Burns
- Cut
- Ingrown_nails
- Laceration
- Stab_wound
- Healthy
.
├── app.py # Main Flask Backend
├── Dockerfile # Container Configuration
├── wound_classifier_final.keras # Trained CNN Model
├── class_names.json # Wound Label Mapping
├── medical_knowledge_db/ # Trusted Medical PDFs
├── chroma_db/ # Persistent Vector Store
├── uploads/ # User Uploaded Images
├── templates/ # Frontend UI (Jinja2)
└── requirements.txt # Dependencies
This project is containerized for production-ready consistency. It uses a Hybrid Architecture where the application logic is isolated in Docker while connecting to the host machine's LLM service.
To Build
docker build -t <image_name> .
To Run
docker run -d --name woundapp
-p 5001:5000
-e OLLAMA_BASE_URL="http://host.docker.internal:11434"
-v "$(pwd)/medical_knowledge_db:/app/medical_knowledge_db"
-v "$(pwd)/chroma_db:/app/chroma_db"
-v "$(pwd)/uploads:/app/uploads"
wound-rag-app
- Networking: host.docker.internal allows the containerized Flask app to communicate with the Ollama service running on the host OS.
- Volumes: Persistent storage is mounted for the medical_knowledge_db and chroma_db to ensure search indices remain intact during restarts.
- Environment Variables: The OLLAMA_BASE_URL allows for flexible LLM endpoint configuration without modifying code.
- RAG over Plain LLM: Prevents medical hallucinations by forcing the model to answer based only on provided medical literature.
- Edge Privacy: By using Ollama, the system performs local inference, ensuring sensitive medical data never leaves the local environment.
- Model Optimization: The CNN handles spatial feature extraction (texture/edges), while the RAG pipeline handles semantic knowledge retrieval.
- DevOps Readiness: Full Dockerization ensures the "it works on my machine" problem is eliminated, providing a clean path to cloud deployment.
- Yuvaraj Kate (yuvarajkate1740@gmail.com)
- Dhamkirti Sisodia (dksisodia002@gmail.com)