-
training.py: This file is responsible for training the chatbot model. It preprocesses the data, creates training samples, sets up the neural network model architecture, defines hyperparameters, and trains the model using the DataLoader. After training, it saves the model's state, input, hidden, and output sizes, along with vocabulary and tags, to a file named "data.pth".
-
model.py: This file contains the definition of the neural network model used for the chatbot. It defines a class called
NeuralNet
that inherits fromtorch.nn.Module
. The model consists of three linear layers with ReLU activation functions between them. -
chatbot.py: This file is responsible for loading the trained model and generating responses to user queries. It loads the preprocessed data and the trained model state from the "data.pth" file. Then, it defines a function called
get_response(msg)
that tokenizes the user's message, converts it into a bag of words, feeds it into the model, and returns a response generated by the model. -
app.py: This file sets up a Flask web application for hosting the chatbot. It defines routes for handling HTTP GET requests to render the index page and POST requests to predict responses to user messages. When a POST request is received with a user message, it calls the
get_response()
function fromchatbot.py
to generate a response. It also logs the chat history to a JSON file named "chat_history.json".
-
Notifications
You must be signed in to change notification settings - Fork 0
muhammedazhar/ProjectChatbot
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
This is college main project that I submitted for my Bachelor of Computer Application course.
Topics
Resources
Code of conduct
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published