File size: 2,043 Bytes
74c3cc0
3afd23e
74c3cc0
 
 
 
 
 
 
 
 
 
3afd23e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
---
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:

```bash
pip install gradio transformers
```

## Usage

To start the application, run the Python script:

```bash
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.

## Author

- [Lucian BLETAN](https://github.com/exaluc)