A college enquiry chatbot built using Python, Machine Learning, and Flask. Students can ask questions about the college and get instant answers without visiting the campus personally.
college_chatbot/
│
├── intents.json ← Training data (questions + responses)
├── train_model.py ← ML model training script (run once)
├── chatbot.py ← Core prediction engine
├── app.py ← Flask web application
├── requirements.txt ← Python dependencies
│
├── model/ ← Auto-created after training
│ ├── chatbot_model.pkl
│ └── responses.pkl
│
├── templates/
│ └── index.html ← Chat UI
│
└── static/
├── css/style.css ← Styling
└── js/chat.js ← Frontend logic
Step 1 — Install the required libraries
pip install -r requirements.txtStep 2 — Train the model
python train_model.pyStep 3 — Start the server
python app.pyStep 4 — Open in browser
http://127.0.0.1:5000
The user types a question in the chat. The message is converted into numbers using TF-IDF vectorization and then passed to a Logistic Regression classifier which predicts the intent. Based on the predicted intent, a response is picked and shown to the user. If the confidence is below 25%, a fallback message is shown instead.
Open intents.json and add a new block like this:
{
"tag": "topic_name",
"patterns": [
"Question 1",
"Question 2"
],
"responses": [
"Answer here"
]
}After adding, run python train_model.py again to retrain the model.
- Language — Python 3.10+
- ML Model — Logistic Regression (Scikit-learn)
- Text Processing — TF-IDF Vectorization
- Web Framework — Flask
- Frontend — HTML, CSS, JavaScript