Welcome to G-Text Classifier, a powerful tool for classifying text based on user-defined labels. Make text classification a breeze! 😎
- Overview
- Features
- Getting Started
- Usage
- Contributing
G-Text Classifier is a user-friendly application that takes a piece of text or a file and classifies it based on the label provided by the user. Whether you're analyzing sentiment, categorizing documents, or any other text classification task, this tool has you covered. Here we used GPT from LlamaIndex beside Gradio open-source Python package to build fast UI components.
Text_classification/ |-- data/: This directory contains the data used for text classification. | |-- Reviews.csv: Sample CSV data for classification (if applicable). | |-- reviews.txt: Sample text data for classification (if applicable).✨ Text Classifier comes with the following features:|-- prototype/: This directory holds the prototype code. | |--webApp.py: The main Python script for the Gradio web application.
|-- src/: This directory contains the project source code. | |-- components/: Subdirectory with essential components for text classification. | | |-- init.py: Initialization file for the components directory. | | |-- helper.py: Helper functions for text classification.
|-- storage/: This directory stores the output of indexing the data for efficient classification. | |-- docstore.json: Document store file. | |-- graph_store.json: Graph store file. | |-- index_store.json: Index store file. | |-- vector_store.json: Vector store file.
|-- README.md: This file, providing an overview of the project and its structure.
📄 Text Classification: Enter plain text along with a label and get instant classification results. 📁 File Upload: Upload text files for batch classification. 🌟 User-Friendly Interface: Built with Gradio for an intuitive and interactive user experience.
👨💻 To get started with Text Classifier, follow these simple steps:
-
Clone the repository:
git clone https://github.com/geehaad/LLamaIndex-Text-Classification.git cd LLamaIndex-Text-Classification
-
Install the required dependencies:
pip install -r requirements.txt
-
Start the application (you can run the helper file to get the output in your terminal, or use the interface):
python helper.py python prototype/webApp.py
- Access the application in your browser at http://localhost:5000. (the linke will appear in your terminal)
- Select the "Text" tab to classify individual text entries.
- Enter the text in the "context" textbox.
- Specify how you want to classify it in the "Labels" textbox.
- Click "Get Classification" to see the result.
- Select the "Files" tab to classify text from a file.
- Upload a text file using the "context" file input.
- Specify the classification labels in the "Labels" textbox.
- Click "Get Classification" to process the file and view the results.
analyze_file(file_path, labels):
Classifies text from a file based on provided labels.
analyze_text(text, labels):
Classifies a single text entry based on provided labels.
To use the helper functions, ensure that your OpenAI API key is set correctly in helper.py.
🤝 We welcome contributions from the community to make Text Classifier even better. If you'd like to contribute, please follow these guidelines:- Fork the repository.
-
Create a new branch:
git checkout -b feature/your-feature-name.
-
Make your changes and commit them:
git commit -m 'Add some feature'.
-
Push to your branch:
git push origin feature/your-feature-name.
- Create a pull request.
Start classifying text like a pro with Text Classifier. Whether it's sentiment analysis, document categorization, or any other text classification task, we've got you covered. If you have any questions or suggestions, feel free to reach out. Happy classifying! 📋🚀
To know more about LlamaIndex: llamaindex.ai