File size: 3,953 Bytes
e428629
 
 
 
 
 
 
 
 
 
 
 
23c6c15
b5c0331
23c6c15
b5c0331
 
23c6c15
 
 
 
 
 
 
e428629
b5c0331
 
23c6c15
 
 
b5c0331
23c6c15
 
 
 
 
 
 
 
 
 
b5c0331
 
 
23c6c15
b5c0331
23c6c15
 
 
 
 
 
 
b5c0331
 
 
23c6c15
b5c0331
23c6c15
 
 
 
 
 
 
b5c0331
 
 
 
 
 
23c6c15
 
b5c0331
 
 
2492bf1
 
 
 
0144efe
a52ad08
e3514b5
f88ffe9
9cb271c
c9d118e
26d4d60
df672bd
9b5d48d
a6f301f
ba8d30d
99a5942
2492bf1
 
 
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
93
94
95
---
title: Masked Word Predictor
emoji: πŸŒ–
colorFrom: green
colorTo: indigo
sdk: gradio
sdk_version: 5.31.0
app_file: app.py
pinned: false
license: apache-2.0
short_description: Masked Word Predicto CPU
---

# πŸ” Masked Word Predictor  
[![Hugging Face Space](https://img.shields.io/badge/HuggingFace-Spaces-blue?logo=huggingface)](https://huggingface.co/spaces/ghostai1/Masked-Word-Predictor)  
[![Gradio UI](https://img.shields.io/badge/Gradio-5.31.0-green?logo=gradio)]  
[![Model](https://img.shields.io/badge/Model-distilroberta--base-orange)](https://huggingface.co/distilroberta-base)  
[![License-MIT](https://img.shields.io/badge/License-MIT-lightgrey)](LICENSE)  

---

## πŸš€ Live Demo  
Try it out here:  
πŸ”— **https://huggingface.co/spaces/ghostai1/Masked-Word-Predictor**

---

## πŸ“ What It Does  
The **Masked Word Predictor** uses a pre-trained DistilRoBERTa model to perform **masked language modeling** in real timeβ€”100 % CPU, zero infra.  
Type any sentence containing the special token `[MASK]` and get the model’s **top-K** fill-in predictions, complete with confidence scores.

> Example use case:  
> > Input:  
> > β€œThe new conditioner made my hair feel [MASK].”  
> >  
> > Output:  
> > | sequence                                   | score  |
> > |--------------------------------------------|--------|
> > | β€œThe new conditioner made my hair feel soft.” | 0.987  |
> > | β€œThe new conditioner made my hair feel smooth.” | 0.923  |
> > …

---

## ✨ Key Features

| πŸ”‘ Feature               | πŸ” Description                                                   |
|--------------------------|------------------------------------------------------------------|
| **🧠 Transformer MLM**      | DistilRoBERTa fill-mask pipeline for lightning-fast predictions   |
| **βš™οΈ Top-K Control**       | Slider to choose how many completions you’d like (1–10)          |
| **πŸ’» CPU-Only Inference**   | Runs on free 2 vCPU/16 GB RAM Spacesβ€”no GPU needed               |
| **🎨 Interactive UI**      | Gradio Blocks with clear input, button, and results table        |
| **πŸ”§ Zero-Config Deploy**   | Drop in three files; Spaces auto-builds & hosts your demo        |

---

## πŸ”¨ How to Use

1. **Open the demo** at  
   `https://huggingface.co/spaces/ghostai1/Masked-Word-Predictor`
2. In the **Input Sentence** field, type a sentence with exactly one `[MASK]` token.  
   - Example: `β€œShe bought a new [MASK] at the salon.”`
3. Set **Top K Predictions** via the slider (default = 5).  
4. Click **Predict 🏷️**.  
5. View the **Predictions** table: each row shows the completed sentence and its confidence.

---

## πŸ› οΈ Local Development

```bash
git clone https://github.com/ghostai1/Masked-Word-Predictor.git
cd Masked-Word-Predictor
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python app.py

## Latest Update

- Updated Gradio UI to version 5.31.0 for enhanced performance. πŸ” - May 29, 2025 πŸ“
- Added support for multiple [MASK] tokens. - June 10, 2025 πŸ“
- Improved DistilRoBERTa prediction speed. πŸŒ– - June 09, 2025 πŸ“
- Updated Gradio UI to version 5.31.0 for enhanced performance. πŸŒ– - June 08, 2025 πŸ“
- Optimized CPU inference for larger inputs. πŸ” - June 07, 2025 πŸ“
- Enhanced top-K slider functionality. βš™οΈ - June 06, 2025 πŸ“
- Added support for multiple [MASK] tokens. πŸš€ - June 05, 2025 πŸ“
- Improved DistilRoBERTa prediction speed. 🧠 - June 04, 2025 πŸ“
- Updated Gradio UI to version 5.31.0 for enhanced performance. πŸš€ - June 03, 2025 πŸ“
- Optimized CPU inference for larger inputs. 🧠 - June 02, 2025 πŸ“
- Enhanced top-K slider functionality. - June 01, 2025 πŸ“
- Added support for multiple [MASK] tokens. πŸŒ– - May 31, 2025 πŸ“
- Improved DistilRoBERTa prediction speed. βš™οΈ - May 30, 2025 πŸ“

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