News-Fact-Checker / README.md
Anas039's picture
Update README.md
ae04bd5 verified
metadata
title: News Fact Checker
emoji: πŸ’»
colorFrom: blue
colorTo: green
sdk: docker
app_file: app.py
pinned: false

Real-Time News Fact Checker with Manual & Automated Analysis

A Flask-based web app that fetches the latest news, summarizes the content, and performs automated as well as manual fact-checking using Google Gemini API.

Features

  • Fetches latest news from NewsAPI
  • Summarizes each article using extractive methods
  • Automatically checks factual accuracy using Gemini models
  • Allows users to manually enter any claim or article and check its factual correctness
  • Displays real-time verdict and supporting evidence

Setup Instructions (Local)

  1. Clone this repository:

    git clone https://github.com/Anas039/news_fact_checker.git
    
  2. Create a virtual environment and install dependencies:

    python -m venv venv
    source venv/bin/activate    # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
    
  3. Set up your API keys:

  4. Run the app:

    python app.py
    
  5. Open http://127.0.0.1:5000/ in your browser.

Hugging Face Spaces Deployment

  1. Create a new Space on Hugging Face Spaces and select the "Flask" SDK.
  2. Upload all project files (except your real .env file) to the Space.
  3. Set your API keys as Secrets in the Space settings:
    • Go to your Space > Settings > Secrets.
    • Add the following secrets:
      • NEWS_API_KEY
      • GEMINI_API_KEY
      • GOOGLE_API_KEY
      • GOOGLE_CSE_ID
      • FLASK_SECRET_KEY
    • Never upload your real .env file or API keys to the repository.
  4. Ensure your requirements.txt is up to date with all dependencies.
  5. The Space will automatically run app.py as the entry point.

Project Structure

  • app.py β€” Main Flask server
  • news_api.py β€” Handles news fetching from NewsAPI
  • summarizer.py β€” Extracts summaries from articles
  • fact_checker.py β€” Integrates Gemini API for fact-checking
  • web_search.py β€” Searches the web for supporting evidence
  • templates/index.html β€” Frontend interface

Notes

  • Ensure you stay within your Gemini API quota limits.
  • For production deployment, secure your API keys using environment variables or Hugging Face Secrets.
  • For local development, use a .env file (never commit this file to public repos).