/LanguageDetectorApp

Real-time background subtraction using OpenCV + Flask with switchable detection algorithms and stylish frontend

Primary LanguageHTMLMIT LicenseMIT

๐ŸŒ Language Detector Web App

Detect the language of any text input instantly using Python, Flask, and LangDetect. Tracks detection history with a clean web UI and smart caching.


## ๐Ÿ“– Overview

Language Detector is a full-stack Flask web application that uses the langdetect library to detect the language of any given text. It includes:

  • ๐Ÿง  Automatic Language Detection using langdetect
  • ๐Ÿ’พ Detection History Tracking with SQLite (via SQLAlchemy)
  • โšก Smart Caching for faster repeat detection
  • ๐Ÿ–ฅ๏ธ Responsive Web Interface with recent detection previews

Built for fast prototyping, linguistic demos, and simple multi-language handling.


โš™๏ธ Features

๐Ÿง  Instant Language Detection

  • Uses langdetect to identify the language code (e.g., en, fr, de, hi)
  • Shows both code and full language name using pycountry

๐Ÿ’พ Recent Detection History

  • Displays last 5 detections on home page
  • View complete paginated history on /history page

๐Ÿš€ Fast Caching

  • Avoids repeated detection for same text using a TTL-based cache (5 minutes default)

๐Ÿ–ฅ๏ธ Clean Web Interface

  • Built with HTML/CSS and modular templates (using Jinja2)
  • Includes 404 and 500 error pages

๐Ÿ› ๏ธ Technologies Used

Category Tech Stack
Backend Flask (Python)
Language Detection langdetect, pycountry
Database SQLite + SQLAlchemy
Frontend HTML, CSS (custom), JS
Caching TTL-based manual Python decorator


๐Ÿ”Œ Flask Endpoints

Route Description
/ Home page with text input + recent detections
/detect API endpoint for POST-based language detection
/history Full history page with pagination

๐Ÿš€ Getting Started

  1. Clone the Repository
git clone https://github.com/Aayushinit/LanguageDetectorApp.git
cd LanguageDetectorApp
  1. Install Dependencies
pip install flask langdetect pycountry flask_sqlalchemy
  1. Run the App
python app.py
  1. Visit in Browser http://localhost:5000

๐Ÿ’ก How It Works

  • Accepts user text input from the frontend
  • langdetect attempts to detect language code
  • pycountry maps language code to human-readable name
  • Result is cached and also saved in the database
  • History is displayed and paginated with timestamps

๐Ÿ”ฎ Future Improvements

  • ๐Ÿ”ค Display detection confidence (if supported)
  • ๐ŸŒ Add language flag icons
  • ๐Ÿ’ฌ Translate detected text
  • ๐Ÿ’ฝ Export detection history as CSV
  • ๐Ÿ“ฑ Mobile-optimized interface with Tailwind CSS

๐Ÿ‘จโ€๐Ÿ’ป Author

Aayush Kadam โ€” Final Year AI & ML Student | Python & Web Enthusiast

"Giving apps the power to understand languageโ€”one line at a time."

LinkedIn ยท GitHub


โญ๏ธ Show Your Support

If you find this project helpful, please โญ the repo and share with your network!


๐Ÿ“œ License

Licensed under the MIT License.

UI and logic were developed for educational and demonstration purposes.