--- 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 πŸ“ - 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