A clean and production-ready Flask API that automatically fixes grammar issues in English text using a pretrained T5 model from HuggingFace.
- 📦 Flask-based RESTful API
- 🤖 Uses
vennify/t5-base-grammar-correction
model - 🛡 Input validation & error handling
- 🚦 Built-in rate limiting: 10 requests/minute
- ⚙️ JSON input/output structure
- 🔁 Automatic model download on first run
- 🧪 Tested with Postman — 100% working
POST /correct
{
"text": "he go to school every day"
}
{
"corrected": "He goes to school every day."
}
The API is rate-limited to 10 requests per minute per IP address.
Exceeding this limit will return:
{
"error": "Rate limit exceeded. Please try again later."
}
pip install -r requirements.txt
This includes:
- Flask
- Flask-CORS
- Flask-Limiter
- Transformers
- Torch
- Python-Dotenv
python "AI-Powered Grammar Corrector API.py"
Server will start at:
http://127.0.0.1:5000/correct
- ✅ Successful correction (200 OK)
⚠️ Empty input → 400 error- 🔁 Exceeded limit → 429 error
- 🖥 Console log with model loading and request logs
💡 You can see real examples on the Gumroad gallery.
You can get a ZIP version with all files, setup instructions, .env.example
, and more:
Contact the author: [email protected]
📬 Telegram: @talabovali
💡 Note: Pricing may vary depending on complexity and target stack.