Spaces:
Running
Running
metadata
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
π Overview
Tap into Masked Language Modeling with DistilRoBERTaβno training required.
Type a sentence containing the special [MASK]
token and get the modelβs top-K completions instantly, all on free CPU.
Key AI concepts:
β’ Masked Language Modeling (MLM) β’ Transformer-based NLP β’ Distilled Architectures β’ Real-time Inference β’ Edge Deployment β’ Cloud-native Demo
β¨ Features
π Feature | π Why Itβs Cool |
---|---|
π§ Transformer MLM | Uses DistilRoBERTa for lightning-fast fills |
β‘ CPU-Only Inference | Runs on free-tier Space (2 vCPU / 16 GB RAM) |
π’ Top-K Control | Slider to choose how many predictions to show |
π¨ Interactive UI | Gradio Blocks: input, button, and DataFrame |
π§ Zero-Config Deploy | Commit three filesβSpaces auto-builds |
π‘ Educational Demos | Great for teaching how MLM works |
ποΈ How It Works
- User Input β Sentence with one or more
[MASK]
tokens. - MLM Pipeline β
pipeline("fill-mask")
computes token-level likelihoods. - Ranking β Returns the top-K predicted tokens with scores.
- UI Rendering β Gradio shows each filled sentence and its confidence.
π οΈ Local Development
git clone https://github.com/your-username/masked-word-predictor.git
cd masked-word-predictor
python3 -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python app.py