How bweezen/healthbot works
Project type and purpose
• This is a lightweight Python-based health chatbot application. It uses NLP and machine-learning to identify diseases from user-provided symptoms.
• Key indicators: model.py (training pipeline), chatbot.py (inference logic), app.py (Streamlit front end), README mentions NLTK, FuzzyWuzzy, scikit, Streamlit.
File structure
• Top-level files:
• model.py – builds and serializes the disease-prediction model and symptom list (outputs disease_model.pkl, symptom_list.pkl into a models/ directory).
• chatbot.py – contains the inference/chat logic: loads the pickled model and symptom list, accepts user input, cleans text, matches symptoms, and predicts diseases.
• app.py – Streamlit front end serving the chat interface and visualization of results.
• README.md – usage instructions and tech stack.
• No additional directories, so models/ is implicit; you may want to explicitly add it to the file tree.
README for additional insights
• Workflow: train once with model.py, then serve via Streamlit using app.py.
• Main components: disease_model.pkl (primary model), symptom_list.pkl (data source for matching).
• Dependencies: Python, NLTK (tokenization), FuzzyWuzzy (fuzzy matching), scikit-learn (ML), Streamlit (UI).
Elements
• Clear labels for each component (e.g., “Model Trainer”, “Model Artifacts”, “Chatbot Engine”, “Streamlit UI”).
• From “Model Trainer” → “Model Artifacts”
• From “Streamlit UI” → “Chatbot Engine” → “Model Artifacts”
• From “Chatbot Engine” → “Streamlit UI” (predictions back to user).
• Training layer (e.g., blue)
• Inference layer (e.g., green)
• Presentation layer (e.g., orange)
Detailed breakdown for each component
• Model Trainer (model.py)
• Inputs: raw dataset (symptoms ↔ diseases)
• Processing: tokenization (NLTK), vectorization, model fitting (scikit-learn)
• Outputs: pickle files
• Model Artifacts (models/)
• disease_model.pkl – the trained classifier
• symptom_list.pkl – list of known symptoms
• Chatbot Engine (chatbot.py)
• Loads pickles, uses FuzzyWuzzy to match user symptom text to list, predicts disease with loaded model
• Streamlit UI (app.py)
• Accepts text input via web form
• Calls chatbot engine functions
• Displays predicted disease and confidence