--- 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