Combat misinformation with cutting-edge NLP and Machine Learning
Quick Start โข Features โข API โข Android App โข Documentation
- ๐ฏ 5 Algorithms: Naive Bayes, Logistic Regression, SVM, SGD, Random Forest
- ๐ 70%+ Accuracy on LIAR benchmark dataset
- ๐ Advanced NLP: TF-IDF, N-grams (1-5), Bag of Words
- โก Real-time predictions with confidence scores
- ๐ Model comparison with learning curves
- ๐ณ Docker containerized for instant deployment
- ๐ REST API with Flask backend
- ๐ฑ Native Android app with Jetpack Compose UI
- ๐ Network security and HTTPS ready
- ๐ Batch prediction support
- ๐ LIAR Dataset: 10,000+ labeled statements
- ๐งน Preprocessing pipeline: Tokenization, stemming, stopword removal
- ๐ EDA included: Distribution plots, quality checks
- ๐จ Visualizations: Confusion matrices, precision-recall curves
- ๐ Complete documentation with guides
- ๐งช 30+ unit tests for reliability
- ๐ง One-command setup automation
- ๐ป Multiple interfaces: CLI, API, Mobile
- ๐ฏ Type hints and docstrings
The API is already hosted and running:
https://spotliar.onrender.com
Test it instantly:
curl https://spotliar.onrender.com/api/healthDownload and install the APK to start verifying news immediately!
- Works on any network (WiFi/Mobile data)
- No setup required
- Instant predictions
git clone <your-repo-url>
cd Fake_News_Detection-master
chmod +x install.sh && ./install.sh
source .venv/bin/activate
python api_server.pydocker-compose up -d
curl http://localhost:5000/api/healthpython prediction.py
Enter news text: Scientists discover new planet
Result: Real News
Confidence: 87.3%import requests
# Use the live API
response = requests.post('https://spotliar.onrender.com/api/predict',
json={'text': 'Breaking news: New discovery announced'})
print(response.json()){
"success": true,
"prediction": "Real News",
"is_fake": false,
"confidence": 0.873,
"confidence_percentage": 87.3
}Live API Base URL: https://spotliar.onrender.com
- Open
android/in Android Studio - Build and run on device
- Enter news text and get instant verification
Base URL: https://spotliar.onrender.com
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Root endpoint (200 OK) |
/api/health |
GET | Health check |
/api/predict |
POST | Predict single news article |
/api/batch-predict |
POST | Predict multiple articles |
/api/info |
GET | API information |
# Live API
curl -X POST https://spotliar.onrender.com/api/predict \
-H "Content-Type: application/json" \
-d '{"text": "Your news article here"}'
# Local development
curl -X POST http://localhost:5000/api/predict \
-H "Content-Type: application/json" \
-d '{"text": "Your news article here"}'- โจ Modern Material Design 3 UI
- ๐จ Jetpack Compose interface
- ๐ Real-time predictions
- ๐ Confidence visualization
- ๐ WiFi and USB connectivity
The app is pre-configured to use the live API at https://spotliar.onrender.com
Build and Install:
cd android
./gradlew assembleDebug
adb install app/build/outputs/apk/debug/app-debug.apkFor local development, update RetrofitClient.kt:
private const val BASE_URL = "http://localhost:5000/" // or your local IPSee Android Setup Guide and Wireless Setup for details.
Raw Text โ Tokenization โ Stopword Removal โ Stemming โ Clean Text
Clean Text โ TF-IDF Vectorization โ N-grams (1-5) โ Feature Matrix
Feature Matrix โ Multiple ML Models โ Grid Search โ Best Model Selection
New Text โ Preprocessing โ Feature Extraction โ Model โ Prediction + Confidence
- Accuracy: 70.2%
- F1 Score: 0.701
- Precision: 0.68
- Recall: 0.72
| Model | Accuracy | F1 Score | Training Time |
|---|---|---|---|
| Logistic Regression | 70.2% | 0.701 | Fast โก |
| Random Forest | 66.5% | 0.666 | Slow ๐ |
| Naive Bayes | 72.3% | 0.723 | Fastest โกโก |
| Linear SVM | 67.9% | 0.679 | Medium ๐ถ |
| SGD | 71.8% | 0.719 | Fast โก |
Fake_News_Detection-master/
โโโ ๐ Core ML Modules
โ โโโ DataPrep.py # Data preprocessing
โ โโโ FeatureSelection.py # Feature extraction
โ โโโ classifier.py # Model training
โ โโโ model_trainer.py # Training utilities
โ โโโ prediction.py # CLI prediction
โ โโโ api_server.py # REST API
โ
โโโ ๐ฆ Models & Data
โ โโโ final_model.sav # Trained model
โ โโโ train.csv # Training data
โ โโโ test.csv # Test data
โ โโโ liar_dataset/ # Original dataset
โ
โโโ ๐ณ Deployment
โ โโโ Dockerfile # Container definition
โ โโโ docker-compose.yml # Orchestration
โ โโโ .env.example # Configuration
โ
โโโ ๐ฑ Android App
โ โโโ android/ # Jetpack Compose app
โ
โโโ ๐งช Testing
โ โโโ tests/ # 30+ unit tests
โ
โโโ ๐ Documentation
โโโ README.md # This file
โโโ QUICKSTART.md # Quick start guide
โโโ DEPLOYMENT.md # Deployment guide
โโโ CONTRIBUTING.md # Contribution guide
- Python 3.6+: Core language
- scikit-learn: ML algorithms
- NLTK: Natural language processing
- Flask: REST API framework
- pandas/numpy: Data manipulation
- Kotlin: Android development
- Jetpack Compose: Modern UI toolkit
- Retrofit: HTTP client
- Material Design 3: UI components
- Docker: Containerization
- pytest: Testing framework
- GitHub Actions: CI/CD (optional)
- ๐ Quick Start Guide - Get running in 5 minutes
- ๐ Deployment Guide - Production deployment
- ๐ API Documentation - Complete API reference
- ๐ Android Setup - Mobile app guide
- ๐ Contributing Guide - How to contribute
- ๐ Wireless Setup - WiFi configuration
Currently deployed on Render.com:
- URL: https://spotliar.onrender.com
- Status: โ Running
- Uptime: 24/7 (free tier may sleep after inactivity)
./start-everything.shRender.com (Recommended - Free):
- Fork this repository
- Connect to Render.com
- Deploy with one click
- See CLOUD_DEPLOYMENT.md for details
Other Platforms:
- ๐ Railway: $5 credit/month
- โก Fly.io: Free tier available
- ๐ฅ Heroku: $5/month
- โ๏ธ AWS/GCP: Full control
See CLOUD_DEPLOYMENT.md for complete deployment guides.
pytest
pytest --cov=. --cov-report=html
make test-coverageTest Coverage: 30+ unit tests covering:
- โ API endpoints
- โ Data preprocessing
- โ Model predictions
- โ Feature extraction
- Source: ACL 2017 Paper by William Yang Wang
- Size: 12,836 labeled statements
- Classes: Binary (True/False)
- Features: Statement text, speaker, context
- Training: 10,240 samples
- Testing: 1,267 samples
- Validation: 1,284 samples
- โ 5 ML models implemented
- โ REST API with Flask
- โ Android app with Jetpack Compose
- โ Docker containerization
- โ Comprehensive documentation
- ๐ฎ Deep learning models (BERT, GPT)
- ๐ Multi-language support
- ๐จ Web interface
- ๐ Real-time dashboard
- ๐ User authentication
- ๐ Model explainability (LIME, SHAP)
- ๐ Kubernetes deployment
- ๐ฑ iOS app
We welcome contributions! See CONTRIBUTING.md for guidelines.
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Original Author: nishitpatel01
- Contributors: See contributors
- LIAR Dataset: William Yang Wang, ACL 2017
- scikit-learn: Machine learning library
- NLTK: Natural language toolkit
- Flask: Web framework
- Jetpack Compose: Android UI toolkit
- ๐ง Email: kpsingh2004@outlook.com
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ Docs: Full Documentation
If you find this project useful, please consider giving it a star! โญ
