A multi-source fake news detection system using ML models and AI-powered analysis. Combines news API verification and advanced analytics in a Streamlit web app.
- Multi-API News Verification: Checks news existence across NewsAPI, GNews, CurrentsAPI, ContextualWeb, and Google Fact Check.
- ML Model Analysis: Uses multiple trained models (Naive Bayes, Logistic Regression, Random Forest, CatBoost) for prediction.
- AI Assessment: Integrates Gemini AI for deep analysis.
- Content Validation: Ensures only news-like content is analyzed.
- Clone the repository
git clone https://github.com/muhammadnavas/Fake_News_Predictor.git cd Fake_News_Predictor - Install dependencies
pip install -r requirements.txt
- Configure API keys
- Copy
.streamlit/secrets.toml.exampleto.streamlit/secrets.tomland fill in your keys:NEWSAPI_KEY = "your_newsapi_key" GNEWS_KEY = "your_gnews_key" CURRENTS_KEY = "your_currents_key" CONTEXTUALWEB_KEY = "your_contextualweb_key" GOOGLE_FACTCHECK_API_KEY = "your_google_factcheck_key" GEMINI_API_KEY = "your_gemini_key"
- Or set keys in
.env(see.env.example).
- Copy
- Run the app
streamlit run app.py
- Enter a news headline or article in the input box.
- The app validates content and runs analysis using selected methods (API, ML, AI).
- View results in tabs: Verification, ML Models, AI Assessment, Summary.
- No news fetched: Ensure API keys are set and match expected names in both secrets and code.
- Analysis blocked: Input must be news-like (headline or article, not personal/casual text).
- Module import errors: Run
pip install -r requirements.txtto install all dependencies. - Secrets parse error: All values in
.streamlit/secrets.tomlmust be quoted strings.
- Never commit real API keys to version control.
.gitignoreexcludes.envand.streamlit/secrets.tomlby default. - Rotate keys if accidentally exposed.
app.py— Main Streamlit appml_analysis.py— ML model loading and analysiscontent_detector.py— Content validationfetch_news.py— News API integrationmodels/— Pretrained ML models