First chatbot using PyTorch
abx-chat is a simple chatbot built with PyTorch and Flask. This project integrates a machine learning model trained with PyTorch to understand and respond to basic intents defined in JSON. The chatbot uses a web interface to interact with users.
- app.py: The main Flask application that serves the chatbot and handles API requests.
- chat.py: Handles the chatbot logic, including loading the model and processing user input.
- data.pth: The trained PyTorch model file.
- intents.json: A JSON file containing the training data and intents used to train the chatbot model.
- model.py: Defines the neural network architecture for the chatbot.
- nltk_utils.py: Contains helper functions using NLTK for text preprocessing.
- train.py: A script to train the chatbot model using data from
intents.json
. - static: Contains static assets for the frontend, including CSS and JavaScript.
- templates: Contains HTML templates for rendering the chatbot interface.
- Machine Learning with PyTorch: Uses a neural network model to understand and respond to user queries.
- Flask Integration: Serves the chatbot via a Flask web application.
- Interactive Chat Interface: Allows users to interact with the chatbot through a simple web-based interface.
- Clone the repository:
git clone https://github.com/abhishekmeena33/abx-chat.git
- Navigate to the project directory:
cd abx-chat
- Install the required dependencies
- Run the Flask application:
python app.py
- Open a web browser and go to
http://127.0.0.1:5000
to interact with the chatbot.
If you want to retrain the model with new intents, you can update intents.json
and then run:
python train.py
If you want to chat with the model in the terminal, you can run:
python chat.py