AI-Powered Fake News Detection with Multi-Source Verification
Cut through the noise. Verify the truth. TruthLens uses advanced AI and multi-source cross-referencing to help you identify misinformation in real-time.
π€ AI-Powered Analysis - Leverages GPT-4/Gemini with RAG (Retrieval Augmented Generation) for intelligent fact-checking
π Multi-Source Verification - Cross-references claims against Reddit discussions, Wikipedia, and multiple news APIs
π― Credibility Scoring - Provides transparent scoring breakdown: source credibility, content consistency, and fact verification
π Interactive Dashboard - Beautiful Streamlit interface with real-time visualizations and detailed breakdowns
πΎ Persistent History - SQLite database tracks all analyzed articles and user feedback
π³ Docker Ready - Full containerization support for easy deployment
βββββββββββββββββββ βββββββββββββββββββ βββββββββββββββββββ
β Streamlit ββββββΆβ FastAPI ββββββΆβ Fake News β
β Frontend β β Backend β β Agent β
βββββββββββββββββββ βββββββββββββββββββ ββββββββββ¬βββββββββ
β
ββββββββββββββββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββββββββ
β β β
βββββββββΌββββββββ βββββββββΌββββββββ βββββββββΌββββββββ
β AI Service β β Reddit Serviceβ β News Service β
β (LLM + RAG) β β β β β
βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ
β β
βββββββββΌββββββββ βββββββββΌββββββββ
β Wikipedia β β Database β
β Service β β (SQLite) β
βββββββββββββββββ βββββββββββββββββ
- Python 3.10+
- API Keys (at least one AI provider required):
- OpenAI API Key or Google Gemini API Key
- Reddit API credentials (optional, for Reddit analysis)
- NewsAPI / GNews / NewsData API keys (optional, for news verification)
-
Clone the repository
git clone https://github.com/yourusername/truthlens.git cd truthlens -
Set up environment (Windows PowerShell)
./quick_setup.ps1Or manually:
python -m venv venv source venv/bin/activate # Windows: .\venv\Scripts\Activate pip install -r requirements.txt python -m spacy download en_core_web_sm
-
Configure API keys
Create a
.envfile in the root directory:# AI Provider (choose one: "openai" or "gemini") AI_PROVIDER=gemini # API Keys GOOGLE_API_KEY=your_gemini_api_key OPENAI_API_KEY=your_openai_api_key # Reddit API (optional) REDDIT_CLIENT_ID=your_reddit_client_id REDDIT_CLIENT_SECRET=your_reddit_secret REDDIT_USERNAME=your_reddit_username REDDIT_USER_AGENT=TruthLens/1.0 # News APIs (optional - at least one recommended) NEWSAPI_KEY=your_newsapi_key GNEWS_API_KEY=your_gnews_key NEWS_DATA_API_KEY=your_newsdata_key # Database DATABASE_URL=sqlite:///./app/data/truthlens.db
-
Run the application
python run.py
Access the application:
- π₯οΈ Frontend: http://localhost:8501
- π‘ API Docs: http://localhost:8000/docs
# Build and run with Docker Compose
docker-compose up --build
# Or build manually
docker build -t truthlens .
docker run -p 8000:8000 -p 8501:8501 --env-file .env truthlensPOST /verify
Content-Type: application/json
{
"title": "Breaking News Headline",
"content": "Full article content here..."
}Response:
{
"verdict": "REAL",
"is_fake": false,
"score": 78,
"confidence": 85,
"processing_time": 3.42,
"details": {
"source_credibility": 25,
"content_consistency": 28,
"fact_verification": 25
}
}POST /feedback
Content-Type: application/json
{
"article_id": 1,
"is_correct": true,
"feedback_text": "Accurate analysis"
}| Variable | Description | Default |
|---|---|---|
AI_PROVIDER |
AI backend: openai or gemini |
gemini |
USE_GPU |
Enable GPU acceleration | False |
WIKIPEDIA_LANGUAGE |
Wikipedia language code | en |
MAX_WIKIPEDIA_RETRIES |
Retry attempts for Wikipedia | 3 |
truthlens/
βββ app/
β βββ agents/
β β βββ fake_news_agent.py # Orchestration logic
β βββ api/
β β βββ app.py # FastAPI endpoints
β βββ frontend/
β β βββ streamlit_app.py # Streamlit UI
β βββ models/
β β βββ database.py # SQLAlchemy models
β βββ services/
β β βββ ai_service.py # LLM & RAG analysis
β β βββ news_service.py # News API integration
β β βββ reddit_service.py # Reddit analysis
β β βββ wikipedia_service.py # Wikipedia lookup
β βββ utils/
β βββ config.py # Environment configuration
βββ docs/ # Documentation
βββ tests/ # Test suite
βββ docker-compose.yml
βββ Dockerfile
βββ requirements.txt
βββ run.py # Application launcher
# Run all tests
pytest tests/
# Run with coverage
pytest tests/ --cov=app --cov-report=html- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- LangChain for the powerful LLM orchestration framework
- Hugging Face for transformer models
- Streamlit for the elegant frontend framework
- FastAPI for the blazing-fast API framework
Built with β€οΈ to fight misinformation