Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
|
@@ -10,5 +10,50 @@ pinned: false
|
|
| 10 |
license: apache-2.0
|
| 11 |
short_description: Masked Word Predicto CPU
|
| 12 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
short_description: Masked Word Predicto CPU
|
| 12 |
---
|
| 13 |
+
# 🔍 Masked Word Predictor
|
| 14 |
+
[](https://huggingface.co/spaces/your-username/masked-word-predictor)
|
| 15 |
+
[]
|
| 16 |
+
[](https://huggingface.co/distilroberta-base)
|
| 17 |
+
[](LICENSE)
|
| 18 |
|
| 19 |
+
---
|
| 20 |
+
|
| 21 |
+
## 🚀 Overview
|
| 22 |
+
Tap into **Masked Language Modeling** with **DistilRoBERTa**—no training required.
|
| 23 |
+
Type a sentence containing the special `[MASK]` token and get the model’s **top-K** completions instantly, all on **free CPU**.
|
| 24 |
+
|
| 25 |
+
> **Key AI concepts:**
|
| 26 |
+
> • Masked Language Modeling (MLM) • Transformer-based NLP • Distilled Architectures • Real-time Inference • Edge Deployment • Cloud-native Demo
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## ✨ Features
|
| 31 |
+
|
| 32 |
+
| 🔑 Feature | 🔍 Why It’s Cool |
|
| 33 |
+
|----------------------------|----------------------------------------------|
|
| 34 |
+
| **🧠 Transformer MLM** | Uses DistilRoBERTa for lightning-fast fills |
|
| 35 |
+
| **⚡ CPU-Only Inference** | Runs on free-tier Space (2 vCPU / 16 GB RAM) |
|
| 36 |
+
| **🔢 Top-K Control** | Slider to choose how many predictions to show |
|
| 37 |
+
| **🎨 Interactive UI** | Gradio Blocks: input, button, and DataFrame |
|
| 38 |
+
| **🔧 Zero-Config Deploy** | Commit three files—Spaces auto-builds |
|
| 39 |
+
| **💡 Educational Demos** | Great for teaching how MLM works |
|
| 40 |
+
|
| 41 |
+
---
|
| 42 |
+
|
| 43 |
+
## 🏗️ How It Works
|
| 44 |
+
|
| 45 |
+
1. **User Input** – Sentence with one or more `[MASK]` tokens.
|
| 46 |
+
2. **MLM Pipeline** – `pipeline("fill-mask")` computes token-level likelihoods.
|
| 47 |
+
3. **Ranking** – Returns the top-K predicted tokens with scores.
|
| 48 |
+
4. **UI Rendering** – Gradio shows each filled sentence and its confidence.
|
| 49 |
+
|
| 50 |
+
---
|
| 51 |
+
|
| 52 |
+
## 🛠️ Local Development
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
git clone https://github.com/your-username/masked-word-predictor.git
|
| 56 |
+
cd masked-word-predictor
|
| 57 |
+
python3 -m venv venv && source venv/bin/activate
|
| 58 |
+
pip install -r requirements.txt
|
| 59 |
+
python app.py
|