A fact-checking application built with FastAPI, Google Gemini API, and SerpAPI. It accepts a claim, fetches live evidence from the web, and processes it for analysis. Gemini then evaluates the context to return a verdict with reasoning, confidence score, and supporting evidence.
- Accepts a claim as input (via API or frontend).
- Fetches live web search results using SerpAPI.
- Cleans and normalizes the claim text.
- Passes evidence snippets into Gemini 1.5 Flash for structured reasoning.
- Returns a structured verdict:
Final Verdict: REAL / FAKE / UNKNOWN Score: Confidence (0–100) Reasoning: Explanation of why Evidence: Context snippets Warnings: Weak/contradictory info if any
.
├── main2.py # FastAPI backend with fact-check pipeline
├── requirements.txt # Python dependencies
├── landing_page/ # (Optional) UI assets / screenshots ---
├── search_query_result/ # Stored snippets/screenshots from search
└── README.md # Documentation
git clone https://github.com/<your-username>/fake-news-detection.git
cd fake-news-detection
python -m venv .venv
On Windows
.venv\Scripts\activate
On macOS/Linux
source .venv/bin/activate
pip install -r requirements.txt
GEMINI_API_KEY=your-gemini-api-key
SERPAPI_API_KEY=your-serpapi-api-key
uvicorn main2:app --reload
http://127.0.0.1:8000
curl -X POST "http://127.0.0.1:8000/fact-check" \
-H "Content-Type: application/json" \
-d '{"claim": "The Eiffel Tower is in Paris"}'
{
"verdict": "REAL",
"score": "95",
"reasoning": "Multiple sources confirm the Eiffel Tower is in Paris.",
"evidence": "- The Eiffel Tower is a landmark in Paris, France.",
"warnings": ""
}
POST /fact-check → Takes a claim and returns a fact-check result
-Python 3.10+
-FastAPI (backend framework)
-Google Gemini API (fact-check reasoning)
-SerpAPI (live web search results)
## Frontend Setup (Angular)
### 1. Navigate to the frontend folder
cd fact-chex
npm install
ng serve
Run the backend
uvicorn main2:app --reload
http://127.0.0.1:8000
The Angular frontend (http://localhost:4200) sends requests to the FastAPI backend (http://127.0.0.1:8000/fact-check).
-
Shu, K., Sliva, A., Wang, S., Tang, J., & Liu, H. (2017). Fake News Detection on Social Media: A Data Mining Perspective. ACM SIGKDD Explorations Newsletter, 19(1), 22- 36. https://doi.org/10.1145/3137597.3137600
-
Zhou, X., & Zafarani, R. (2020). A Survey of Fake News: Fundamental Theories, Detection Methods, and Opportunities. ACM Computing Surveys, 53(5), 1–40. https://doi.org/10.1145/3395046
-
Google AI. Gemini LLM Documentation. https://ai.google.dev
.png)
.png)
.png)