How shrutijaiswal2905/fake-news-detection-website works
Project Type and Purpose
• This is a data-science-driven, single-page Streamlit application for real-time fake-news detection.
• It combines a lightweight frontend (Streamlit UI) with a backend ML inference pipeline (TF-IDF vectorization + Logistic Regression), plus calls to external services (GNews API, Newspaper3k).
File Structure
Top-level:
• .gitignore, LICENSE, README.md
• Fake-News-Detection/
– .streamlit/config.toml (UI theming & Streamlit config)
– .vscode/ (IDE settings)
– app.py (main Streamlit app entry point)
– appbackup.py (previous iteration of app.py)
– Fake.csv, True.csv (training data snapshots)
– vectorizer.jb, lr_model.jb (serialized TF-IDF vectorizer & Logistic Regression model)
– requirements.txt (python dependencies)
Key Insights from README
• Frontend: Single Streamlit dashboard, dark theme, multiple input modes (URL, keyword, text).
• Backend: Loads a pre-trained TF-IDF vectorizer + Logistic Regression model via Joblib; uses Newspaper3k for parsing URL content, GNews API for live headlines.
• Flow: Input → fetch & preprocess → vectorize → model.predict → display result.
Main Components
a. User Interface (Streamlit App)
b. Input Handler
• URL fetcher (Newspaper3k)
• GNews API client
• Text ingestion (manual input)
c. Preprocessing Pipeline
• Text cleaning & normalization
• TF-IDF Vectorizer (vectorizer.jb)
d. Inference Engine
• Logistic Regression Classifier (lr_model.jb)
e. Results Renderer (Streamlit)
f. External Services
• GNews API
• Newspaper3k extraction
g. Local Artifacts
• Fake.csv / True.csv (training data) – optional, shown for context
• vectorizer.jb, lr_model.jb (model artifacts)
Relationships & Data Flows
• (Optionally) show model artifacts loaded from disk at app startup
Architectural Patterns & Principles
• Separation of Concerns: UI, data fetching, preprocessing, inference all distinct
• Initialization-Time Loading: Load vectorizer & model once to minimize latency
• Stateless Requests: Each user action is handled independently
• External-Service Adapters: Wrap GNews API & Newspaper3k in dedicated modules
Final Checklist
[ ] Clear labels for each component
[ ] A container or boundary showing “Streamlit App” vs. “External Services” vs. “Local Artifacts”