Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/trisdeveloper/ai-word-predictor
An AI model to predict a masked word in a text sequence.
https://github.com/trisdeveloper/ai-word-predictor
Last synced: 6 days ago
JSON representation
An AI model to predict a masked word in a text sequence.
- Host: GitHub
- URL: https://github.com/trisdeveloper/ai-word-predictor
- Owner: trisDeveloper
- Created: 2024-10-18T14:31:34.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-11-05T19:12:26.000Z (14 days ago)
- Last Synced: 2024-11-05T19:29:45.435Z (14 days ago)
- Language: Python
- Size: 127 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
---
title: Word Predictor
emoji: π’
colorFrom: yellow
colorTo: pink
sdk: gradio
sdk_version: 5.5.0
app_file: app.py
pinned: false
license: mit
short_description: AI Masked Word Prediction Tool
---# π Masked Word Prediction Tool
A web tool that predicts missing words in sentences, using BERT to handle multiple masked words at once. Simply type your sentence with masked words (as `_`) and get accurate predictions in real-time.
[![TensorFlow](https://img.shields.io/badge/TensorFlow-FF6F00?style=for-the-badge&logo=tensorflow&logoColor=white)](https://www.tensorflow.org/)
[![Transformers](https://img.shields.io/badge/Transformers-FFB7B2?style=for-the-badge&logo=transformers&logoColor=black)](https://huggingface.co/transformers/)
[![Gradio](https://img.shields.io/badge/Gradio-4F9E5A?style=for-the-badge&logo=gradio&logoColor=white)](https://gradio.app/)
[![Hugging Face](https://img.shields.io/badge/Hugging_Face-FF3C00?style=for-the-badge&logo=huggingface&logoColor=white)](https://huggingface.co/)
[![Python](https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://www.python.org/)
[![NumPy](https://img.shields.io/badge/NumPy-013243?style=for-the-badge&logo=numpy&logoColor=white)](https://numpy.org/)
[![Pandas](https://img.shields.io/badge/Pandas-150458?style=for-the-badge&logo=pandas&logoColor=white)](https://pandas.pydata.org/)
[![Keras](https://img.shields.io/badge/Keras-FF3C00?style=for-the-badge&logo=keras&logoColor=white)](https://keras.io/)## π― Features
- Predicts single or multiple masked words in a sentence.
- Fast predictions (0.3 to 1.8 seconds) using optimized BERT-based masked language modeling.
- User-friendly interface with customizable masked word token (`_` by default).## π How It Works
The app leverages **BERT** for masked language modeling, using Hugging Face's `transformers` library for powerful NLP capabilities. Hereβs how it handles predictions:
1. Replaces any `_` in the input text with the BERT `[MASK]` token.
2. Processes each `[MASK]` position in the sentence individually to predict likely words.## π₯ Try It Out
[Launch the App on Hugging Face Spaces](https://huggingface.co/spaces/tris-dev/word-predictor)
### Example Usage
Type in a sentence with `_` for masked words:
> _ order to achieve our goals, we need to focus on _ strategies that will improve our teamβs _ and use our resources _.
The model might predict:
> **In** order to achieve our goals, we need to focus on **developing** strategies that will improve our teamβs **performance** and use our resources **effectively**.
## β‘ Performance
Thanks to optimization efforts, the app responds quickly, averaging between **0.3** to **1.8 seconds** per prediction depending on the input length.
## π οΈ Installation (For Local Use)
1. Clone the repository and install dependencies to get started locally.
```bash
git clone https://github.com/trisDeveloper/AI-Word-Predictor
cd AI-Word-Predictor
pip install -r requirements.txt
```
2. Run the app with: `python app.py`### π License
MIT License