A full-stack intelligent chatbot application designed for university/campus environments, featuring NLP-based question answering, timetable management, and student services.
This project consists of three main components:
- NLP Training Pipeline - Uses sentence transformers for semantic understanding of campus-related queries
- Backend API - FastAPI server providing RESTful endpoints for chatbot functionalities
- Frontend UI - React-based user interface with Material-UI components
- NLP-Powered Q&A: Semantic search using sentence embeddings and cosine similarity
- Timetable Management: Access class schedules and timetables
- Student Services:
- Submit complaints
- Share suggestions
- View mess menu
- View cafe menu
- Data Integration: Handles classes, subjects, teachers, and scheduling information
invie-chatbot/
├── chat/
│ ├── backend/
│ │ └── main.py # FastAPI backend server
│ └── frontend/
│ ├── public/ # Static assets
│ └── src/
│ ├── App.js # Main React component
│ └── index.js # Entry point
├── chatbot_nlp_training.ipynb # NLP model training notebook
├── timetablecsv.ipynb # Timetable processing notebook
├── classes.csv # Class data
├── subjects.csv # Subject data
├── teachers.csv # Teacher data
├── processed_qa_data.csv # Preprocessed Q&A pairs
├── question_embeddings.npy # Pre-computed question embeddings
└── new queries.json # Query dataset
- FastAPI - Modern Python web framework
- CORS Middleware - Cross-origin resource sharing support
- React 19 - UI framework
- Material-UI (MUI) - Component library
- Emotion - CSS-in-JS styling
- sentence-transformers - Sentence embeddings
- scikit-learn - Cosine similarity and ML utilities
- pandas - Data manipulation
- numpy - Numerical computations
- Python 3.8+
- Node.js 14+
- npm or yarn
# Navigate to backend directory
cd chat/backend
# Install Python dependencies
pip install fastapi uvicorn sentence-transformers scikit-learn pandas numpy
# Run the backend server
uvicorn main:app --reload --host 0.0.0.0 --port 8000# Navigate to frontend directory
cd chat/frontend
# Install dependencies
npm install
# Start the development server
npm startThe frontend will be available at http://localhost:3000 and the backend at http://localhost:8000.
The chatbot uses a pre-trained sentence transformer model to understand and respond to queries:
-
Open the training notebook:
jupyter notebook chatbot_nlp_training.ipynb
-
Training Process:
- Load Q&A data from JSON files
- Preprocess questions (lowercase, remove special characters)
- Generate sentence embeddings using
SentenceTransformer - Compute cosine similarity for query matching
- Save embeddings to
question_embeddings.npy
-
Model: Uses pre-trained sentence transformer models (e.g.,
all-MiniLM-L6-v2) for semantic understanding
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Health check |
| GET | /timetable |
Fetch timetable data |
| POST | /complaint |
Submit a complaint |
| POST | /suggestion |
Submit a suggestion |
| GET | /mess-menu |
Get mess menu |
| GET | /cafe-menu |
Get cafe menu |
- classes.csv - Class schedules and information
- subjects.csv - Subject details and metadata
- teachers.csv - Faculty information
- processed_qa_data.csv - Cleaned question-answer pairs
- question_embeddings.npy - Pre-computed embeddings for fast retrieval
- new queries.json - Sample queries for testing
- Modern gradient background design
- Responsive Material-UI components
- Real-time backend connectivity check
- Clean and intuitive user interface
cd chat/frontend
npm testcd chat/frontend
npm run build- Start the backend server
- Launch the frontend application
- The chatbot will connect to the backend automatically
- Users can:
- Ask questions about campus facilities
- Check timetables
- Submit feedback
- View dining options
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available for educational purposes.
- Sentence Transformers library for NLP capabilities
- FastAPI for the robust backend framework
- Material-UI for the beautiful UI components
For questions or support, please open an issue in the repository.
Note: This is a development version. For production deployment, ensure proper security measures, environment variables, and API authentication are implemented.