CoolFace
Apppublic

sakshamwadhankar21/truthlens-backend

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes
App README

TruthLens ๐Ÿ”

Advanced Real-Time Fake News Detection & Verification System

Python Django License Status

TruthLens (formerly News Guardian) is a robust web application designed to combat misinformation. It leverages advanced Web Scraping, Natural Language Processing (NLP), and Machine Learning to verify news claims in real-time by cross-references them against credible sources on the live internet.


๐Ÿš€ Key Features

  • โ€”Real-Time Verification: Instantly verifies claims by searching the live web using DuckDuckGo.
  • โ€”Intelligent Scraping: Robustly extracts content from diverse news sources, handling partial data and anti-bot measures.
  • โ€”AI-Powered Analysis:
  • โ€”Semantic Similarity: Uses SpaCy and Sentence-Transformers to compare claims with gathered evidence.
  • โ€”Summarization: Automatically condenses long articles into digestible summaries using LSA.
  • โ€”Zero-Shot Classification: Detects hate speech, profanity, and other harmful content patterns.
  • โ€”Visual Context: Generates dynamic WordClouds to visualize the key themes of the verified news.
  • โ€”Graceful Degradation: Smart fallback logic ensures users get results even if some data sources fail.

๐Ÿ› ๏ธ Technology Stack

ComponentTechnology
Backend FrameworkDjango (Python)
FrontendHTML5, Bootstrap 5, Custom CSS
Search EngineDuckDuckGo (duckduckgo-search)
Scrapingrequests, BeautifulSoup4
NLP CorespaCy (en_core_web_md), sumy (LSA)
Machine Learningsentence-transformers (RoBERTa), Hugging Face Pipeline
Visualizationwordcloud, matplotlib

๐Ÿ—๏ธ Architecture

TruthLens follows a clean Service-Oriented Architecture within the standard Django MVT pattern:

  • โ€”Service Layer (`facts/services.py`): Encapsulates all complex business logic (Search, Scrape, NLP, Verification). This ensures the views remain lightweight and the logic is reusable.
  • โ€”Controller (`facts/views.py`): Handles HTTP requests, orchestrates the service calls, and manages the data flow to the template.
  • โ€”Prototypes (`research_prototypes/`): Contains isolated scripts for debugging and testing the search/scrape pipeline independently.

๐Ÿ’ป Installation & Usage

Prerequisites

  • โ€”Python 3.10 or higher
  • โ€”Git

1. Clone the Repository

bash
git clone https://github.com/sakshamwadhankar/-EV55_Desync.git
cd -EV55_Desync

2. Install Dependencies

It is recommended to use a virtual environment.

bash
pip install -r requirements.txt
python -m spacy download en_core_web_md

3. Run Migrations

bash
python manage.py migrate

4. Start the Server

bash
python manage.py runserver

Access the application at `http://127.0.0.1:8000/`


๐Ÿ“ How it Works

  1. 1.Input: User enters a news headline or claim (e.g., "India is under world war").
  2. 2.Search: The system queries DuckDuckGo for relevant, recent articles.
  3. 3.Process:
  4. 4.Top URLs are scrapped for content.
  5. 5.Text is filtered, cleaned, and summarized.
  6. 6.Verify:
  7. 7.Cosine similarity checks alignment between the claim and the evidence.
  8. 8.Safety classifiers check for hate speech or profanity.
  9. 9.Result: The user receives a True/Fake verdict, a confidence summary, source links, and a context word cloud.

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


๐Ÿ“„ License

This project is open-source and available under the MIT License.