VeriNewsAI is a sophisticated, production-ready system designed to combat misinformation. By leveraging hybrid AI models, it analyzes news articles in real-time to determine their credibility.
- 🔍 Intelligent URL Extraction: Seamlessly extracts core article content from any URL using the
newspaper3klibrary. - 🤖 Hybrid Multi-Model Scoring:
- AI Core (70%): Powered by Hugging Face's BERT-based fake news detection models.
- Suspicion Engine (30%): Heuristic keyword-based analysis to catch common misinformation patterns.
- 📝 LLM Explainer: Provides human-readable, context-aware explanations for every score using Google Gemini 1.5 Flash.
- ⚡ High Performance:
- In-memory caching for repetitive requests.
- Predictive model warm-up on server startup.
- 🛡️ Robust Design: Structured logging, request timeouts (10s), and a reliable fallback mechanism when AI services are unreachable.
- Core Framework: FastAPI (Asynchronous, High-performance)
- AI Models: Hugging Face Inference API (BERT), Google Gemini 1.5 Flash
- Web Scraping: Newspaper3k
- Data Validation: Pydantic v2
- Utilities: Python-dotenv, Uvicorn, Requests
- Interface: Clean, responsive HTML/JS dashboard
- Architecture: Statically served from the API backend
- Python 3.9 or higher
- API Keys for Hugging Face and Google Gemini
-
Clone the Repository
git clone <repo-url> cd VeriNewsAI
-
Setup Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Configuration Create a
.envfile in the root directory:HF_API_KEY=your_huggingface_inference_api_key GEMINI_API_KEY=your_google_gemini_api_key PORT=8000
-
Fire it up!
python main.py
Server will start at
http://localhost:8000.
GET /health
- Description: Returns the system status and model readiness.
POST /analyze
- Body:
{ "url": "https://example-news.com/article-123", "detailed": true } - Sample Response:
{ "result": "Fake", "score": 88, "confidence": "High", "explanation": "The article uses highly sensationalized language and lacks citations from verified sources...", "source": "url", "processing_time_ms": 1150 }
VeriNewsAI/
├── frontend/ # Web dashboard (HTML/JS/CSS)
├── routes/ # FastAPI API routers
├── services/ # Business logic (Scraper, AI Detector, Explainer)
├── utils/ # Logging, Caching, and Text Processing
├── main.py # Application entry point & configuration
├── requirements.txt # Backend dependencies
└── render.yaml # Deployment configuration
This project is licensed under the MIT License - see the LICENSE file for details.
Developed with ❤️ for a more informed world.