--- 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 📝 - Improved multi-label classification support. 🏷️ - May 30, 2025 📝 **Website**: https://ghostainews.com/ **Discord**: https://discord.gg/BfA23aYz