Skip to content

This is college main project that I submitted for my Bachelor of Computer Application course.

Notifications You must be signed in to change notification settings

muhammedazhar/ProjectChatbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ProjectChatbot

  1. 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".

  2. model.py: This file contains the definition of the neural network model used for the chatbot. It defines a class called NeuralNet that inherits from torch.nn.Module. The model consists of three linear layers with ReLU activation functions between them.

  3. 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.

  4. 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 from chatbot.py to generate a response. It also logs the chat history to a JSON file named "chat_history.json".

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

No packages published