A small fact-checking app that can:
- Train a Naive Bayes model using a bag-of-words vocabulary
- Evaluate the model
- Classify new news from:
- manual text (title + body)
- a URL (scraping)
- an image (OCR)
- Batch classify from a CSV
- Scrape multiple URLs and store results
- Python 3.9+
Install dependencies:
pip install -r requirements.txtNote: The OCR part uses Tesseract (
pytesseract). Ensure Tesseract is installed on your system.
run_cli.py/run_gui.py: entry pointssrc/cli.py: CLI menusrc/gui.py: Tkinter GUIsrc/fake_news_detector.py: chooses CLI vs GUI based on--cli/--guisrc/training.py: training logicsrc/evaluation.py: evaluation logicsrc/verifier.py: verifies/classifies an input (optionally across multiple seeds)src/scraper.py: scraping helperssrc/ocr_reader.py: OCR extraction
From the repo root:
python run_cli.pyYou’ll see a menu with options like:
- Train model
- Evaluate model
- Classify new article (manual / URL / image)
- Batch classify from CSV
- Scrape news (multiple URLs)
- Export Bag-of-Words CSV for last seed
- Reload stopwords
python run_gui.pyTabs:
- Detect News: classify text / URL / image (OCR)
- Scraping: paste URLs and scrape into
data/true.csvordata/false.csv - Training & Settings: train/retrain, evaluate, export vocabulary, reload stopwords
python -m src.fake_news_detector --cli
python -m src.fake_news_detector --gui(If your Python import path differs, use run_cli.py / run_gui.py instead.)
In the CLI menu:
- Choose
3) Classify new article - Select mode
1) manual - Enter title and text
The app will only mark results CONFIDENT when models agree across configured seeds.
In the CLI menu:
- Choose
3) Classify new article - Select mode
2) URL
- Choose
3) Classify new article - Select mode
3) image - Select an image file (
.png/.jpg/.jpeg/.bmp)
The app uses the following CSVs:
data/true.csvdata/false.csvdata/stopwords.csv
It also writes logs into:
logs/user_inputs.csvlogs/scraped_log.csvlogs/metrics_history.csvlogs/training_log.csv
- If OCR fails:
- confirm Tesseract is installed
- make sure
pytesseractcan find the Tesseract executable
- If you see missing-model/vocabulary errors:
- run Train model first (CLI menu option
1or GUI training tab)
- run Train model first (CLI menu option
Add your license here.