metadata
title: Falcon
emoji: π₯
colorFrom: indigo
colorTo: yellow
sdk: docker
pinned: false
Falcon: Fake News Analysis and Language Comprehension for Online Neutrality
Falcon is an advanced Gen AI-powered system designed to analyze, verify, and classify online claims to promote digital content neutrality. Leveraging state-of-the-art language models, it classifies user-submitted text, detects tone and intent, verifies facts using multiple data sources, and generates an informed verdict about claim credibility.
Features
- Claim Classification: Classifies input text into categories like Factual Claim, Opinion, Irrelevant Talk, or Vague/Incomplete.
- Tone and Intent Detection: Analyzes the emotional tone and intent behind the claim (e.g., neutral, persuasive, humorous).
- Fact Verification: Verifies factual claims by searching reliable sources like Google (via Serper API) and Wikipedia.
- Verdict Generation: Produces a clear verdict on the claimβs truthfulness based on gathered evidence and reasoning.
- Fallback Language Model: Uses OpenAIβs GPT-4 as the primary LLM and automatically switches to Deepseek as a fallback model to ensure high availability and robustness.
- Simple Web Interface: Easy-to-use frontend using HTML, CSS, and JavaScript for seamless user interaction.
- FastAPI Backend: Fast, lightweight API server handling all processing with asynchronous endpoints.
Tech Stack
- Backend: FastAPI (Python)
- Frontend: HTML, CSS, JavaScript
- Language Models: OpenAI GPT-4 (primary), Deepseek (fallback)
- APIs: Serper API (Google Search), Wikipedia API
- Prompt Engineering: Carefully crafted templates for accurate and reliable results
- Deployment: Docker containerization (optional)
Project Structure
falcon/
βββ backend/
β βββ api/
β β βββ claims.py # Claim classification logic
β β βββ fact_check.py # Fact verification logic
β β βββ tone_intent.py # Tone and intent detection logic
β βββ langchain_tools.py # LangChain prompt templates and LLM wrappers
β βββ config.py # API keys and config variables
β βββ main.py # FastAPI app entry point
βββ frontend/
β βββ index.html # Main UI page
β βββ assets/ # CSS, JS, images
βββ Dockerfile # Docker container definition (optional)
βββ README.md # This file
Setup Instructions
Prerequisites
- Python 3.9+
- FastAPI
- Uvicorn (ASGI server)
- OpenAI API key
- Serper API key
- Deepseek API key (for fallback)
Installation
- Clone the repository:
git clone https://github.com/yourusername/falcon.git
cd falcon
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Configure API keys in
backend/config.py:
OPENAI_API_KEY = "your_openai_api_key"
SERPER_API_KEY = "your_serper_api_key"
DEEPSEEK_API_KEY = "your_deepseek_api_key"
- Run the FastAPI server:
uvicorn backend.main:app --port 8000
- Open your browser and visit
http://localhost:8000to use the Falcon app.
Usage
- Enter a claim or statement in the input form.
- The system classifies the claim, detects tone and intent, performs fact verification if applicable, and returns a detailed verdict with supporting evidence.
- The fallback model Deepseek is automatically used if GPT-4 is unavailable, ensuring consistent performance.