ChatBot for University purpose: The chatbot elevates the university website, providing valuable information to users, students & parents.📚💡
IT WAS LIVE ON JAYPEE UNIVERSITY'S OFFICIAL WEBSITE (https://www.juit.ac.in/)
It had more than 2500+ active monthly users.
Chatbot Link : https://strident-narrow-goatfish.anvil.app/
Steps & Explaination :
The code you provided appears to be a chatbot implementation using a neural network model for intent classification. It consists of two parts: training the chatbot model and using the trained model for chatbot interaction.
In the training part:
- The code loads the training data from a JSON file (
intents.json
) containing text examples and corresponding intents. - The text examples and intents are extracted from the data and stored in separate lists.
- The text data is tokenized using the
Tokenizer
class from Keras and converted to sequences. - The tokenizer is saved to a pickle file (
tokenizer.pickle
) for later use during chatbot interaction. - The sequences are padded to have equal length using the
pad_sequences
function. - The intents are encoded using the
LabelEncoder
from scikit-learn, and one-hot encoded usingtf.one_hot
. - The model architecture is defined using Keras layers, including an embedding layer, LSTM layer, and dense output layer.
- The model is compiled with a categorical cross-entropy loss function and Adam optimizer.
- The model is trained on the padded sequences and one-hot encoded intents for a specified number of epochs.
After training, the model is saved to a file (chatbot_model.h5
) for later use during chatbot interaction.
In the chatbot interaction part:
- The code loads the chatbot data from a JSON file (
intents_final.json
) containing text examples and intents. - The user input is obtained, and if the user types "quit," the program exits.
- The user input is encoded using the saved tokenizer and padded to match the maximum sequence length used during training.
- The model is loaded from the saved file (
chatbot_final.h5
). - The user input is passed through the model to predict the intent.
- The predicted intent is mapped back to its original label using the label encoder.
- A response is randomly selected from the intent's available responses and displayed as the chatbot's reply.
This model has been given an user interface by creating a web app using Anvil. That also requires web designing, building interconnection between model & webapp using python statements. Finally, the model is deployed on AWS (Amazon Web Services) so that ML model can run 24/7 without any kind interruption.
Note: Please make sure you have the necessary dependencies installed, such as TensorFlow and scikit-learn, before running this code. Also, ensure that you have the required JSON files (intents.json
and intents_final.json
) in the correct locations.