https://github.com/jenson073/intent-based_chatbot
This project is an intent-based chatbot built using NLP, machine learning, and deployed with Streamlit for interactive conversations.
https://github.com/jenson073/intent-based_chatbot
ai chatbot intent-based nlp random-forest streamlit
Last synced: 3 months ago
JSON representation
This project is an intent-based chatbot built using NLP, machine learning, and deployed with Streamlit for interactive conversations.
- Host: GitHub
- URL: https://github.com/jenson073/intent-based_chatbot
- Owner: Jenson073
- Created: 2024-12-30T02:22:58.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-05T12:41:01.000Z (5 months ago)
- Last Synced: 2025-01-12T12:33:01.702Z (5 months ago)
- Topics: ai, chatbot, intent-based, nlp, random-forest, streamlit
- Language: Jupyter Notebook
- Homepage:
- Size: 290 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ค Intent-Based Chatbot with Streamlit
This repository contains two intent-based chatbots built using Natural Language Processing (NLP) techniques. One chatbot is deployed using **Localtunnel**, and the other is deployed directly through a **Streamlit account**.
---
## ๐ View the Deployed Chatbot
To interact with the chatbot deployed using Streamlit, click the link below:
[๐ Chatbot URL](https://intent-basedchatbot-jenson.streamlit.app)---
## ๐ ๏ธ Running and Setup Instructions
### ๐งช For Localtunnel Deployment
To view and run the chatbot deployed using Localtunnel, follow the instructions in the provided Jupyter Notebook (`.ipynb`). The notebook contains step-by-step instructions for:
1๏ธโฃ Setting up the environment
2๏ธโฃ Preparing the data and code
3๏ธโฃ Running the chatbot using Localtunnel on Streamlit### ๐ For Streamlit Deployment
To run the chatbot with a Streamlit account:
1. โ๏ธ Create an account on the [Streamlit website](https://streamlit.io).
2. ๐ Copy the `app.py`, `requirements.txt`, and `intents.json` files to a GitHub repository.
3. ๐ง Go to your [Streamlit account](https://streamlit.io), and click on **Create App**.
4. ๐ Connect your GitHub repository and fill out the required fields.
5. ๐ Streamlit will fetch the details from GitHub and generate a public URL for your app.---
## ๐งฉ Code Explanation
### **1๏ธโฃ Data Loading and Structure**
- **Patterns**: User input phrases (e.g., "Hello", "How are you?").
- **Tags**: Intent labels (e.g., "greeting", "goodbye").
- **Responses**: Predefined chatbot responses for each tag.### **2๏ธโฃ Data Preprocessing**
- ๐ **TF-IDF Vectorization**: Converts patterns into numerical data.
- ๐ข **Label Encoding**: Converts intent tags into numerical values.### **3๏ธโฃ Machine Learning Model Training**
- ๐ค Uses a **Random Forest Classifier** for intent classification.
- ๐ Predicts user intent and retrieves a relevant response.### **4๏ธโฃ Streamlit Interface**
- ๐ฌ **Text Input**: Users type their messages.
- ๐๏ธ **Chat History**: Displays conversation logs.
- ๐ **Model Evaluation**: Includes accuracy metrics and a classification report.### **5๏ธโฃ Deployment**
- ๐ Localtunnel for public URL generation.
- ๐ Streamlit for seamless web app deployment.---
## ๐ ๏ธ Troubleshooting
### โ ๏ธ **Bad Gateway Error (Localtunnel)**
- **Solution**: Restart Localtunnel or reload the URL.### โ ๏ธ **Issues with Streamlit Deployment**
- Ensure `requirements.txt` and `intents.json` are properly linked in the GitHub repository.---
## ๐ Requirements
- **Google Drive** (account for storing files)
- **Google Colab** (Any Python environment supporting Jupyter notebooks)
- ๐ฅ๏ธ **Python 3.6+**
- ๐ **Streamlit** (For running the interactive app)
- ๐ง **NLTK** (for natural language processing)
- ๐ **scikit-learn** (for ML model training)
- ๐ **localtunnel** (for public URL generation)
- ๐พ A GitHub repository with the required files.---
## ๐ Steps to Deploy Streamlit App
1. **Prepare Files**:
- `app.py`: Main Streamlit app.
- `intents.json`: Chatbot data file.
- `requirements.txt`: Python dependencies.2. **Push Files to GitHub**:
- Upload the above files to a GitHub repository.3. **Create a Streamlit App**:
- Visit [Streamlit](https://streamlit.io).
- Click **Create App**.
- Select your GitHub repository.
- ๐ Streamlit will generate a public URL for your chatbot.---
### ๐ Enjoy chatting with the bot! ๐ค๐ฌ