An open API service indexing awesome lists of open source software.

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.

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! ๐Ÿค–๐Ÿ’ฌ