Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📰 FactCheck Engine

AI-Powered News Credibility & Verification Platform
Transparent machine learning verification with Explainable AI (XAI), URL extraction, and clickbait auditing.


🌟 Overview

FactCheck Engine is a modern, full-stack AI platform designed to evaluate news credibility. Unlike traditional "black-box" classifiers, FactCheck Engine provides complete transparency: it predicts whether an article is REAL or FAKE, calculates exact mathematical feature attributions to highlight the words that influenced the model, and audits the headline for emotional manipulation and clickbait.


✨ Key Features

  • 🧠 Explainable AI (XAI):
    • Uses mathematical feature attribution ($w_i \cdot x_i$) to explain why the model made its prediction.
    • Highlights specific keywords pushing toward Misinformation (Fake Cues) vs. Credibility (Real Cues).
  • ⚡ Clickbait & Exaggeration Checker:
    • Scans headlines for ALL-CAPS shouting, excessive punctuation (!!, ?!), curiosity gaps, and alarmist phrasing.
    • Provides an instant risk score (LOW, MODERATE, HIGH) with specific detection explanations.
  • 🔗 Direct URL Auto-Extraction:
    • Paste any live web link to automatically scrape the article title, publication domain, and clean body text.
    • Hardened with Server-Side Request Forgery (SSRF) defense against private and loopback networks.
  • 🌐 Publisher Domain Credibility:
    • Evaluates domain reputation against a database of wire services (Reuters, AP, BBC, NPR), verified publishers, satire networks, and unverified blogs.
  • 🔒 Privacy-First Local Cache (Zero Database):
    • Recent scan history is stored 100% inside your browser's local cache (localStorage).
    • No databases required, zero server storage, and zero tracking of scanned articles.
  • 📱 Fully Responsive Design:
    • Optimized for desktop, tablet, and mobile with fluid typography, balanced grid columns, and touch-screen support.
  • 📄 One-Click Export & Print Reports:
    • Copy verification summaries to the clipboard or export clean PDF dossiers using the built-in print stylesheet.

🏗️ Architecture & Tech Stack

Fake_News_Detector-main/
├── backend/
│   ├── app.py              # Flask REST API, ML inference, SSRF protection, scraper
│   ├── models/             # Serialized Scikit-learn models
│   │   ├── model.pkl       # Logistic Regression classifier
│   │   ├── vectorizer.pkl  # TF-IDF n-gram vectorizer
│   │   └── selector.pkl    # SelectKBest 10,000-feature selector
│   └── requirements.txt    # Python dependencies
├── frontend/
│   ├── index.html          # Semantic HTML5 interface
│   ├── style.css           # Vanilla CSS responsive design system
│   └── script.js           # Client application logic & localStorage cache
└── README.md               # Project documentation

Technology Highlights

  • Backend: Python 3.8+, Flask, Flask-CORS, Gunicorn
  • Machine Learning: Scikit-Learn (Logistic Regression + SelectKBest), NumPy, NLTK (Lemmatization & Stopwords)
  • Web Scraping: Requests, BeautifulSoup4 (BS4) with SSRF network validation
  • Frontend: Vanilla HTML5, Modern CSS (Glassmorphism, Grid/Flexbox), Vanilla JavaScript (ES6+)

🚀 Quick Start & Installation

1. Prerequisites

  • Python 3.8 or higher installed on your machine.
  • pip package manager.

2. Setup & Installation

Clone or extract the repository, then navigate to the project directory:

cd Fake_News_Detector-main/backend

Create a virtual environment (recommended):

# Windows
python -m venv venv
venv\Scripts\activate

# Linux / macOS
python3 -m venv venv
source venv/bin/activate

Install the required dependencies:

pip install -r requirements.txt

3. Run the Application

Launch the Flask development server:

python app.py

Open your browser and navigate to:

http://127.0.0.1:5000

🛡️ Security & Reliability

  • SSRF Defense: The URL scraper validates target hostnames against DNS resolution to block private IP ranges (RFC 1918), loopback interfaces (127.0.0.1, localhost), and cloud metadata IP addresses (169.254.169.254).
  • Defensive Type Coercion: Input sanitization prevents server crashes (AttributeError / 500) when handling empty or null JSON values.
  • WSGI Lifecycle Readiness: Models load immediately upon module import, preventing cold-start delays or 503 errors under production WSGI servers like Gunicorn.
  • Zero Database Footprint: All user scan history is stored client-side in localStorage, maintaining complete user privacy.

⏱️ Health Check & Uptime Monitoring

A dedicated, lightweight health endpoint is provided for external uptime monitors (such as UptimeRobot):

  • Endpoint: GET /health (also supports HEAD)
  • Expected Response: HTTP 200 OK with body:
    {
      "status": "ok"
    }
  • Purpose: External uptime services can be configured outside the application to ping https://<YOUR-RENDER-APP>.onrender.com/health periodically (e.g., every 5 to 14 minutes). This helps reduce Render Free-tier idle spin-down and cold-start latency.
  • Note: Periodic external pings reduce idle sleep behavior, but do not guarantee that the service can never restart or achieve 100% permanent uptime, as Render Free-tier instances periodically restart during platform maintenance and are subject to monthly free instance-hour quotas.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

AI-powered fake news detector with Explainable AI (XAI), live URL extraction, and clickbait analysis. Built with Python, Flask, and Scikit-Learn.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages