Skip to content

Latest commit

Β 

History

History
108 lines (80 loc) Β· 2.66 KB

File metadata and controls

108 lines (80 loc) Β· 2.66 KB

E-commerce Chatbot using Python & Flask

An intelligent chatbot built using Python and Flask for e-commerce platforms. It can handle user queries, assist with product navigation, and respond to common customer questions. The chatbot is integrated into a web interface with basic routes and templates.


πŸš€ Features

  • 🧠 NLP-based chatbot for intelligent responses
  • πŸ›οΈ Product page route (/product) with UI integration
  • πŸ’¬ Chat interface via AJAX (Flask + JS)
  • πŸ” Dynamic response system using JSON
  • πŸ“ Modular code (chat logic, model training, and routes separated)

πŸ› οΈ Tech Stack

Layer Tech Used
Frontend HTML5, CSS, JavaScript
Backend Python, Flask
NLP NLTK / custom model
Others JSON, Pickle

πŸ“‚ Project Structure

ecommerce-chatbot/
β”œβ”€β”€ app.py                 # Main Flask app with route handling
β”œβ”€β”€ chat.py                # Chatbot logic and response generation
β”œβ”€β”€ model.py               # Handles model loading or predictions
β”œβ”€β”€ train.py               # Train chatbot with intents.json
β”œβ”€β”€ nltk_utils.py          # Tokenization, stemming, bag of words
β”œβ”€β”€ data.pth               # Trained model data (torch/pickle)
β”œβ”€β”€ intents.json           # Training data for chatbot
β”‚
β”œβ”€β”€ static/
β”‚   β”œβ”€β”€ app.js             # JS for frontend chat interaction
β”‚   β”œβ”€β”€ style.css          # Basic styling
β”‚   └── images/            # Placeholder for any assets
β”‚
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ base.html          # Homepage
β”‚   └── product.html       # Product page
β”‚
└── venv/                  # Virtual environment

πŸ§ͺ Getting Started

1️⃣ Clone the Repo

git clone https://github.com/yourusername/ecommerce-chatbot.git

2️⃣ Create Virtual Environment

python -m venv venv
source venv/bin/activate        # Windows: venv\Scripts\activate

3️⃣ Install Requirements

pip install flask

4️⃣ Train the Model (if needed) and Run the App

python train.py
python app.py

Visit: http://127.0.0.1:5000


Example Intents

{
  "tag": "greeting",
  "patterns": ["Hi", "Hello", "Is anyone there?"],
  "responses": ["Hello! How can I assist you today?"]
}

🀝 Contributing

Pull requests are welcome. Open issues for suggestions or bugs. Support Us https://aniclothe.roytechub.com/


Author

Bidyut Roy πŸ’Ό Portfolio: https://github.com/roytechub

☺️ Happy Coding