Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

🧠 CNN Text Classifier Assistant – Streamlit App

This is an interactive Streamlit chatbot application that guides users through building a CNN-based text classification model using a dataset they upload. The app leverages OpenAI's GPT-4o for intelligent guidance and performs data preprocessing, model training, and confusion matrix evaluation—all in a user-friendly, conversational format.


📁 Project Structure

├── .gitignore            # Ignore saved models, temporary files, etc.
├── app.py                # Main Streamlit application
├── requirements.txt      # Python dependencies

🚀 Features

  • Upload CSV dataset
  • 🧹 Text preprocessing with customizable options
  • 🔠 Tokenization & label encoding for CNN input
  • 🧠 Dynamic CNN model training with adjustable architecture
  • 📊 Confusion Matrix visualization after training
  • 💾 Model download (as .zip) post training
  • 🤖 OpenAI GPT-4o integration for interactive guidance

🔧 Setup Instructions

1. Clone the repository

git clone https://github.com/yourusername/cnn-text-classifier-chatbot.git
cd cnn-text-classifier-chatbot

2. Create and activate a virtual environment (optional but recommended)

python -m venv venv
source venv/bin/activate    # On Windows use `venv\Scripts\activate`

3. Install dependencies

pip install -r requirements.txt

4. Set your OpenAI API key

You can either:

  • Export it in your terminal:
export OPENAI_API_KEY=your_openai_api_key
  • Or modify app.py to hardcode it temporarily:
api_key = "your_openai_api_key"

5. Run the app

streamlit run app.py

📌 How to Use

  1. Upload a CSV file via the sidebar.

  2. Select the text and label columns.

  3. Follow the chatbot's guidance to:

    • Explore data
    • Clean and preprocess it
    • Prepare it for CNN training
    • Configure and train the model
  4. Visualize the confusion matrix.

  5. Download the trained model.


🧠 Model Architecture

The CNN model is built dynamically based on user-defined layers (Conv1D, MaxPooling1D, Dense, Dropout, etc.). Users can customize:

  • Number of layers
  • Kernel sizes, filters
  • Activation functions
  • Optimizer, learning rate, and more

📦 Dependencies

Major libraries:

  • streamlit
  • openai
  • pandas, numpy, matplotlib
  • tensorflow, sklearn

Full list in requirements.txt


📈 Example Use Case

Upload a dataset of product reviews labeled as "positive" or "negative", clean the data, define a CNN model, train it, and visualize classification performance—all via a conversational assistant.



🪪 License

MIT License (or your own if different)

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages