A newer version of the Gradio SDK is available:
5.1.0
title: zstc
emoji: π
colorFrom: green
colorTo: red
sdk: gradio
sdk_version: 4.25.0
app_file: app.py
pinned: false
license: mit
Zero-Shot Text Classification with BART
This project demonstrates a web application built with Gradio that utilizes the facebook/bart-large-mnli
model for zero-shot text classification. Users can input text and specify candidate labels to see how the model classifies the input without having been directly trained on those labels.
Features
- Zero-Shot Classification: Classify text into user-specified categories without direct training on those categories.
- User-Friendly Interface: Easy-to-use web interface built with Gradio.
- Multi-Label Support: Option for multi-label classification, allowing a single piece of text to belong to multiple categories.
Installation
To run this project, you will need Python and pip. First, clone this repository and navigate to the project directory. Then, install the required dependencies:
pip install gradio transformers
Usage
To start the application, run the Python script:
python app.py
Navigate to the URL provided by Gradio in your terminal to access the web interface.
Examples
The application includes predefined examples that demonstrate how to use the interface:
- "The market has been incredibly volatile this year, with tech stocks leading the charge." with labels "finance, technology, sports, education"
- "LeBron James scores 30 points to lead the Lakers to a Game 7 victory over the Celtics." with labels "sports, technology, finance, entertainment"
- And more...
Customization
You can customize the candidate labels and select whether the classification should be multi-label directly in the interface.
Technology
This project is built using the following technologies:
- Gradio: An open-source library to build ML-powered web apps.
- Transformers: A state-of-the-art natural language processing library.