Spaces:
Sleeping
Sleeping
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)
Clone this repository:
git clone https://github.com/Anas039/news_fact_checker.gitCreate a virtual environment and install dependencies:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txtSet up your API keys:
- Get your NewsAPI key from https://newsapi.org
- Get your Gemini API key from https://makersuite.google.com/app/apikey
- Get your Google Custom Search API key and CSE ID from https://programmablesearchengine.google.com/
- Create a
.envfile in thenews_fact_checkerdirectory (see.env.examplefor required variables)
Run the app:
python app.pyOpen
http://127.0.0.1:5000/in your browser.
Hugging Face Spaces Deployment
- Create a new Space on Hugging Face Spaces and select the "Flask" SDK.
- Upload all project files (except your real
.envfile) to the Space. - Set your API keys as Secrets in the Space settings:
- Go to your Space > Settings > Secrets.
- Add the following secrets:
NEWS_API_KEYGEMINI_API_KEYGOOGLE_API_KEYGOOGLE_CSE_IDFLASK_SECRET_KEY
- Never upload your real
.envfile or API keys to the repository.
- Ensure your
requirements.txtis up to date with all dependencies. - The Space will automatically run
app.pyas the entry point.
Project Structure
app.pyβ Main Flask servernews_api.pyβ Handles news fetching from NewsAPIsummarizer.pyβ Extracts summaries from articlesfact_checker.pyβ Integrates Gemini API for fact-checkingweb_search.pyβ Searches the web for supporting evidencetemplates/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
.envfile (never commit this file to public repos).