TruthLens detects fake news and spam using three independent AI layers working together.
| Layer | Technology | Accuracy |
|---|---|---|
| ML Layer | TF-IDF + Logistic Regression | 99.3% |
| Wikipedia Layer | Cosine Similarity | Live API |
| AI Layer | Groq LLaMA 3.3-70B | Explanation |
- 99.3% fake news detection accuracy
- 98.1% spam detection accuracy
- Live Wikipedia cross-verification
- Groq LLaMA 3.3-70B AI explanations
- Confidence gauge meter
- Credibility score breakdown
- Real-time suspicious word detection
- URL article fetcher and analyzer
- Batch headline analyzer
- User authentication login and register
- Search history with timestamps
- Usage statistics dashboard
- Download analysis report
- WhatsApp share button
- GDPR compliant data deletion
- Source credibility checker
- Language detection
- Dark and light mode toggle
- Mobile responsive design
- Backend: Python Flask Scikit-learn SQLite
- ML: TF-IDF Vectorizer Logistic Regression
- APIs: Wikipedia REST API Groq Cloud API
- Frontend: HTML5 CSS3 JavaScript Chart.js
# 1. Clone the repository
git clone https://github.com/Janani7975/TruthLens.git
cd TruthLens
# 2. Create virtual environment
python -m venv venv
venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Create .env file with your keys
# GROQ_API_KEY=your_groq_key_here
# SECRET_KEY=truthlens2026
# 5. Download datasets from Kaggle into data/ folder
# Fake and Real News Dataset → data/Fake.csv and data/True.csv
# SMS Spam Collection → data/spam.csv
# 6. Train the models one time only
python train_models.py
# 7. Run the application
python main.pyOpen browser at http://127.0.0.1:5000
- Email: demo@truthlens.com
- Password: demo123
TruthLens/ ├── app/ │ ├── routes.py │ └── services/ │ ├── ml_service.py │ ├── wikipedia_service.py │ ├── ai_report_service.py │ ├── combination_engine.py │ ├── url_service.py │ ├── source_service.py │ └── language_service.py ├── database/ │ └── db.py ├── static/ │ ├── style.css │ └── script.js ├── templates/ │ ├── index.html │ └── login.html ├── train_models.py ├── main.py └── requirements.txt
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/analyze-full | Full 3-layer analysis |
| POST | /api/detect/fake-news | ML only detection |
| POST | /api/detect/spam | Spam detection |
| POST | /api/analyze-url | URL article analyzer |
| POST | /api/analyze-batch | Batch analyzer |
| GET | /api/history | Search history |
| GET | /api/statistics | Usage stats |
| DELETE | /api/privacy/delete-data | GDPR delete |
| Metric | Fake News | Spam |
|---|---|---|
| Accuracy | 99.3% | 98.1% |
| Precision | 97.1% | 97.8% |
| Recall | 97.3% | 94.2% |
| F1 Score | 97.2% | 96.0% |