Spaces:
Sleeping
Sleeping
| 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 | |