Spaces:
Sleeping
Sleeping
File size: 2,333 Bytes
67c64b3 d6b9484 67c64b3 |
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 63 64 65 66 67 68 69 |
---
title: Zero Shot Classifier
emoji: π
colorFrom: purple
colorTo: yellow
sdk: gradio
sdk_version: 5.35.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Zero-shot text label predictor.
---
# π§ Zero-Shot Text Classifier (Hugging Face Version)
A smart and lightweight web app built with **Gradio** and **Transformers** that classifies your input text into the most likely label β using **Zero-Shot Learning**.
## π§ About the Model
- **Pipeline**: `zero-shot-classification`
- **Model**: `facebook/bart-large-mnli`
- **Framework**: Hugging Face Transformers
- **Task**: Predict a relevant label even if the model wasn't trained on it
## π‘ Features
- Accepts custom comma-separated labels
- Returns top predictions with confidence scores
- Works in real-time β hosted via Hugging Face Spaces
## βοΈ Instructions for Users
This app uses **zero-shot classification** to find the most relevant label based on your input and label list.
π **How to use:**
1. Enter a sentence or paragraph
2. Enter comma-separated labels like: `Technology, Sports, Food`
3. The app will return top labels with confidence scores
β οΈ **Note:**
- Avoid overlapping or vague labels. It may reduce prediction accuracy.
- For example, a sentence about economy and healthcare might score both **Finance** and **Health**.
- The answer may reflect multiple topics if the sentence spans more than one area β this is expected behavior in such cases.
β
**Example 1:**
- **Text:** `Roger Federer won another grand slam title, cementing his legacy in tennis.`
- **Labels:** `['Politics', 'Fashion', 'Sports']`
- **Prediction:** `Sports β 99.2%`
β
**Example 2:**
- **Text:** `The chef used fresh ingredients and spices to prepare a delicious Indian curry.`
- **Labels:** `['Food', 'Health', 'Travel']`
- **Prediction:** `Food β 88.9%`
β
**Example 3:**
- **Text:** `Climate change is leading to rising sea levels and more frequent extreme weather events.`
- **Labels:** `['Environment', 'Fashion', 'Technology']`
- **Prediction:** `Environment β 88.5%`
---
## π How to Run Locally
Install the required packages:
```bash
pip install -r requirements.txt
```
Then run the app:
```bash
python app.py
```
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|