{"id":18386064,"url":"https://github.com/ramarav/fake_news_detection","last_synced_at":"2026-04-10T17:03:05.052Z","repository":{"id":224705612,"uuid":"271984520","full_name":"ramarav/Fake_News_Detection","owner":"ramarav","description":"Machine learning approach for fake news detection using Scikitlearn","archived":false,"fork":false,"pushed_at":"2020-06-13T10:13:24.000Z","size":11615,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-02-16T00:24:42.970Z","etag":null,"topics":["itertools","jupyter-notebook","jupyter-notebooks","machine-learning","machine-learning-algorithms","machinelearning","numpy","pandas","passiveaggressiveclassifier","python","python-3","python3","scikit-learn","scikitlearn-machine-learning","tfidfvectorizer"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ramarav.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-06-13T10:09:52.000Z","updated_at":"2024-01-10T12:17:56.000Z","dependencies_parsed_at":"2024-02-27T11:14:26.032Z","dependency_job_id":"bb78c5fb-ec92-4ea1-a0fa-1e9587748832","html_url":"https://github.com/ramarav/Fake_News_Detection","commit_stats":null,"previous_names":["ramarav/fake_news_detection"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramarav%2FFake_News_Detection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramarav%2FFake_News_Detection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramarav%2FFake_News_Detection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramarav%2FFake_News_Detection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramarav","download_url":"https://codeload.github.com/ramarav/Fake_News_Detection/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505937,"owners_count":21115354,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["itertools","jupyter-notebook","jupyter-notebooks","machine-learning","machine-learning-algorithms","machinelearning","numpy","pandas","passiveaggressiveclassifier","python","python-3","python3","scikit-learn","scikitlearn-machine-learning","tfidfvectorizer"],"created_at":"2024-11-06T01:20:05.268Z","updated_at":"2025-12-30T23:05:07.282Z","avatar_url":"https://github.com/ramarav.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Fake News Detection using ML + Generative AI\n\n### 🧠 Detect fake vs. real news headlines and explain the reasoning using OpenAI GPT-4o-mini.\n\n---\n\n## 🏗️ Project Overview\nThis upgraded version of the classic Fake News Detection project adds an **LLM-powered explainability layer**.  \nTraditional ML models classify news articles, while **GPT-4o-mini** provides a human-readable justification of why an article is likely fake or real.\n\n---\n\n## ⚙️ Tech Stack\n\n| Layer | Technology | Purpose |\n|-------|-------------|----------|\n| 🧩 Machine Learning | **Scikit-Learn** | Core fake/real classification |\n| 🧠 Generative AI | **OpenAI GPT-4o-mini** | Natural-language explanations |\n| 💻 Frontend | **HTML + CSS** | Simple, responsive web interface |\n| 🌐 Backend | **Flask** | Web app for serving predictions |\n| 💾 Storage | **joblib, pandas** | Model + dataset handling |\n\n---\n\n## 🧩 Features\n- 📰 Classifies news as **FAKE** or **REAL** using Passive Aggressive Classifier.  \n- 🔍 Generates **explanations** via GPT-4o-mini for every prediction.  \n- 🌐 Flask-based web app with an easy-to-use text input box.  \n- 📈 Confusion matrix \u0026 accuracy summary available on `/metrics`.  \n- 🧱 Modular folder structure for quick extension or retraining.\n\n---\n\n## 📁 Folder Structure\n```\nFake_News_Detection/\n│\n├── app.py                     # Flask entry point\n├── requirements.txt            # Dependencies\n├── model/\n│   ├── fake_news_model.pkl     # Trained PAC model\n│   └── tfidf_vectorizer.pkl    # TF-IDF vectorizer\n│\n├── data/\n│   └── news.csv                # Dataset (Kaggle-style)\n│\n├── utils/\n│   ├── gpt_explainer.py        # GPT-4o-mini text explanations\n│   ├── model_loader.py         # Load + predict helpers\n│   └── preprocess.py           # Text preprocessing utils\n│\n├── templates/\n│   └── index.html              # Web interface\n│\n├── static/\n│   └── style.css               # Styling\n│\n└── README.md\n```\n\n---\n\n## 🧰 Setup Instructions\n\n```bash\n# 1️⃣ Clone the repository\ngit clone https://github.com/ramarav/Fake_News_Detection.git\ncd Fake_News_Detection\n\n# 2️⃣ Create a virtual environment\npython -m venv venv\nsource venv/bin/activate  # on Windows use venv\\Scripts\\activate\n\n# 3️⃣ Install dependencies\npip install -r requirements.txt\n\n# 4️⃣ Add your OpenAI API key (for explanations)\nset OPENAI_API_KEY=your_api_key_here  # Windows\nexport OPENAI_API_KEY=your_api_key_here  # macOS/Linux\n\n# 5️⃣ Run Flask app\npython app.py\n```\n\nThen open [http://localhost:5000](http://localhost:5000) 🎯\n\n---\n\n## 🧪 Sample Output\n\n| Input | Prediction | Explanation |\n|--------|-------------|--------------|\n| “NASA confirms aliens discovered near Mars base.” | **FAKE** | “This resembles tabloid-style unverifiable claims.” |\n| “UN reports global hunger dropped by 10% in 2024.” | **REAL** | “The phrasing and reference to official data suggest credibility.” |\n\n---\n\n## 🧮 Model Performance\n| Metric | Value |\n|---------|--------|\n| Accuracy | **93.13%** |\n| Classifier | PassiveAggressiveClassifier |\n| Vectorizer | TF-IDF (max_df=0.7, stop_words='english') |\n\n---\n\n## 🏷️ Badges\n\n![Python](https://img.shields.io/badge/Python-3.9%2B-blue.svg)\n![Flask](https://img.shields.io/badge/Flask-2.x-green.svg)\n![Scikit-Learn](https://img.shields.io/badge/ScikitLearn-1.5-orange.svg)\n![OpenAI](https://img.shields.io/badge/OpenAI-GPT--4o--mini-purple.svg)\n![License](https://img.shields.io/badge/License-MIT-lightgrey.svg)\n![Contributions](https://img.shields.io/badge/Contributions-Welcome-brightgreen.svg)\n\n---\n\n## 📦 API Endpoint Example\n\n**POST** `/predict`\n```bash\ncurl -X POST http://127.0.0.1:5000/predict      -H \"Content-Type: application/json\"      -d '{\"text\": \"Breaking: New vaccine approved by WHO\"}'\n```\n\n**Response:**\n```json\n{\n  \"prediction\": \"REAL\",\n  \"explanation\": \"WHO approvals are verified through credible institutional sources.\"\n}\n```\n\n---\n\n## 💡 Future Enhancements\n- [ ] Integrate news source credibility scoring  \n- [ ] Add multilingual detection  \n- [ ] Deploy using Docker + Render  \n- [ ] Support voice-based input (Speech-to-Text)\n\n---\n\n## 👨‍💻 Author\n**Mekala Ramarao**  \nAMD India  \nFocus: AI/ML applications in NLP, GPU analytics, and intelligent automation.  \n📧 [LinkedIn](https://www.linkedin.com/in/mekala-ramarao-a2b5a562/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framarav%2Ffake_news_detection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framarav%2Ffake_news_detection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framarav%2Ffake_news_detection/lists"}