File size: 4,353 Bytes
c5694ce
 
 
 
 
 
 
 
 
 
 
 
64f9c8f
 
 
 
 
c5694ce
64f9c8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7f540ce
 
 
 
2df0031
678494d
a83d8cc
f79666f
2ed5a3f
0d40549
daaa200
eb566e8
e36b397
03aea8e
7ecac1a
d944781
6a55d3f
917172c
67a79f7
425fe09
a78c73e
eb1d88e
aff8ef4
9f37063
b6b750d
a4bc9f1
70f893f
cf5689c
7f540ce
 
 
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
---
title: CPU Only Zero Shot Text Classification
emoji: πŸƒ
colorFrom: gray
colorTo: purple
sdk: gradio
sdk_version: 5.31.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: ' CPU-only Zero-Shot Text Classification'
---
# 🏷️ Zero-Shot Text Classification  
[![Hugging Face Space](https://img.shields.io/badge/HuggingFace-Spaces-blue?logo=huggingface)](https://huggingface.co/spaces/your-username/zero-shot-classifier)  
[![Gradio UI](https://img.shields.io/badge/Gradio-5.31.0-brightgreen?logo=gradio)]  
[![Model](https://img.shields.io/badge/Model-BART--MNLI-orange)](https://huggingface.co/facebook/bart-large-mnli)  
[![License](https://img.shields.io/badge/License-MIT-lightgrey)](LICENSE)

---

## πŸš€ Overview  
Unlock **zero-shot classification** for any textβ€”no fine-tuning required.  
Define your own label set on the fly and see how well each label matches your input, powered by **BART-MNLI** on CPU.

> **AI buzzwords:**  
> Natural Language Inference β€’ Zero‐shot Learning β€’ Transformer-based NLP β€’ Real-time Inference β€’ Edge Deployment β€’ Cloud-native Demo

---

## ✨ Features

| πŸ”‘ Feature                     | πŸ” Description                                                  |
|--------------------------------|----------------------------------------------------------------|
| **πŸš€ Zero-Shot**                | Classify into arbitrary categories without task-specific data  |
| **⚑ CPU-Only Inference**        | Runs on free Hugging Face Spaces (2 vCPU / 16 GB RAM)         |
| **πŸŽ›οΈ Single vs. Multi-Label**   | Toggle between exclusive or overlapping labels                |
| **🎨 Interactive UI**           | Gradio Blocks with text input, label list, mode toggle, table |
| **πŸ”§ No Training Needed**       | Leverages pre-trained BART-MNLI via HF Transformers           |
| **☁️ Instant Deploy**           | Commit three filesβ€”Spaces auto-builds & hosts your demo       |

---

## πŸ—οΈ How It Works

1. **User Input** – Paste any sentence or paragraph.  
2. **Label Definition** – Enter comma-separated candidate labels (e.g. β€œPositive, Negative, Question”).  
3. **Model Inference** – Pipeline computes entailment scores for each label.  
4. **Result Table** – Display each label with its confidence score.

All done **locally on the Space**, ensuring **privacy**, **zero API cost**, and **lightning speed**.

---

## πŸ› οΈ Local Development

```bash
git clone https://github.com/your-username/zero-shot-classifier.git
cd zero-shot-classifier
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python app.py

## Latest Update

- Updated BART-MNLI model for better accuracy. - May 29, 2025 πŸ“
- Optimized CPU inference speed. πŸš€ - June 22, 2025 πŸ“
- Added support for custom label sets. - June 21, 2025 πŸ“
- Enhanced Gradio UI responsiveness. - June 20, 2025 πŸ“
- Improved multi-label classification support. - June 19, 2025 πŸ“
- Updated BART-MNLI model for better accuracy. - June 18, 2025 πŸ“
- Optimized CPU inference speed. 🧠 - June 17, 2025 πŸ“
- Added support for custom label sets. ⚑ - June 16, 2025 πŸ“
- Enhanced Gradio UI responsiveness. - June 15, 2025 πŸ“
- Improved multi-label classification support. - June 14, 2025 πŸ“
- Updated BART-MNLI model for better accuracy. 🧠 - June 13, 2025 πŸ“
- Optimized CPU inference speed. - June 12, 2025 πŸ“
- Added support for custom label sets. - June 11, 2025 πŸ“
- Enhanced Gradio UI responsiveness. - June 10, 2025 πŸ“
- Improved multi-label classification support. 🏷️ - June 09, 2025 πŸ“
- Updated BART-MNLI model for better accuracy. - June 08, 2025 πŸ“
- Optimized CPU inference speed. ⚑ - June 07, 2025 πŸ“
- Added support for custom label sets. - June 06, 2025 πŸ“
- Enhanced Gradio UI responsiveness. πŸš€ - June 05, 2025 πŸ“
- Improved multi-label classification support. πŸŽ›οΈ - June 04, 2025 πŸ“
- Updated BART-MNLI model for better accuracy. πŸŽ›οΈ - June 03, 2025 πŸ“
- Optimized CPU inference speed. ⚑ - June 02, 2025 πŸ“
- Added support for custom label sets. 🧠 - June 01, 2025 πŸ“
- Enhanced Gradio UI responsiveness. πŸš€ - May 31, 2025 πŸ“
- Improved multi-label classification support. 🏷️ - May 30, 2025 πŸ“

**Website**: https://ghostainews.com/
**Discord**: https://discord.gg/BfA23aYz