Skip to content

Application that automatically transcribes and verifies factual claims from videos, Instagram posts, and free-text input using OpenAI’s most advanced models. Designed for seamless, multilingual fact-checking with web-integrated validation and intuitive UX.

Notifications You must be signed in to change notification settings

owgit/factCheck

Repository files navigation

AI-Powered Fact Check Tool | Video & Instagram Content Verification

Python OpenAI FastAPI React Docker

Automated Video Verification & Fact-Checking Platform

An AI-powered fact-checking application that automatically transcribes, analyzes, and verifies claims from videos, Instagram content, and text. Using OpenAI's GPT-4o and Whisper models, this tool helps combat misinformation by providing evidence-based verification with accurate source references.

Key Features

  • 🎬 Multi-Source Verification: Process videos, Instagram posts, and free text input
  • 🔊 AI Transcription: Convert speech to text using OpenAI's Whisper model
  • Advanced Fact Checking: Verify claims using OpenAI's GPT-4o with web search capabilities
  • 🔍 Claim Detection: Automatically extract and analyze factual statements
  • 📱 User-Friendly Interface: Intuitive tabbed design for different input methods
  • 📊 Detailed Verification Reports: Comprehensive fact-check results with reliability scores and sources
  • 🌐 Multilingual Support: Automatically detects input language and responds accordingly
  • 📑 Web Search Integration: Cross-references claims with online information sources

Features

  • 🎬 Video Upload: Support for various video formats (mp4, mov, avi)
  • 🔊 Automatic Transcription: Convert speech to text using OpenAI's Whisper model
  • AI Fact Checking: Verify claims using OpenAI's GPT-4o
  • 🔍 Image Analysis: Extract and analyze visual content from videos
  • 📱 Responsive UI: User-friendly interface for uploading and reviewing results
  • 📊 Detailed Reports: Get comprehensive fact-check reports with sources
  • 🌐 Multilingual Support: Automatically detects input language and responds in the same language for transcription, fact-checking, and image analysis

Tech Stack

Backend

  • Python with FastAPI
  • OpenAI API integration
  • MoviePy for video processing
  • Instagram API integration (optional)

Frontend

  • React-based web interface
  • Tailwind CSS for styling
  • Framer Motion for animations

Infrastructure

  • File system storage for uploads
  • Environment-based configuration
  • CORS support for secure API access

Screenshots

2 1

Installation

Prerequisites

  • Python 3.9+
  • Node.js and npm
  • OpenAI API key
  • FFmpeg (for video processing)
  • Docker and Docker Compose (optional, for containerized setup)

Setup

Option 1: Traditional Setup

  1. Clone the repository

    git clone https://github.com/yourusername/fact-check.git
    cd fact-check
  2. Copy env.example to .env and fill in your credentials

    cp env.example .env
  3. Install backend dependencies

    pip install -r requirements.txt

    or with conda:

    conda env create -f environment.yml
  4. Install frontend dependencies

    cd video-transcription-frontend
    npm install

Option 2: Docker Setup

  1. Clone the repository

    git clone https://github.com/yourusername/fact-check.git
    cd fact-check
  2. Copy env.example to .env and fill in your credentials

    cp env.example .env
  3. Build and start the Docker containers

    docker-compose up -d

    This will:

    • Build the backend container with Python and FastAPI
    • Build the frontend container with Node.js and React
    • Configure Nginx for serving the frontend and proxying API requests
    • Set up volume mapping for uploads and environment variables
  4. Access the application at http://localhost

Usage

Running with Docker

# Start the services
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the services
docker-compose down

# Rebuild and start the services (after making changes)
docker-compose up -d --build

# Debug Docker issues
./docker-debug.sh

Troubleshooting

Docker Issues

If you encounter issues with the Docker setup:

  1. Run the debugging script: ./docker-debug.sh
  2. Check container logs: docker-compose logs
  3. Verify file permissions in containers
  4. Ensure your .env file is correctly set up
  5. If necessary, rebuild containers: docker-compose up -d --build
  • Error: No such file or directory: Ensure all paths in docker-compose.yml are correct and that you've created any required directories.
  • Backend can't connect to OpenAI API: Verify your API key in the .env file is correct and that you have sufficient credits.
  • Frontend not connecting to backend: Check the REACT_APP_API_URL in your environment variables and ensure the backend service is running.

Instagram Integration Issues

The Instagram integration uses third-party libraries to download content from Instagram for fact-checking. Due to Instagram's measures against automated access, you may encounter the following issues:

Common Errors

  1. 401 Unauthorized Error: Instagram is actively blocking the connection.

    • Solution: Try using different Instagram credentials in your .env file.
    • Alternative: Download the video manually and upload it directly.
  2. "Could not find window._sharedData" Error: Instagram has changed their page structure.

    • Solution: Wait for a library update or use the manual upload option.
  3. No media found after download: The content might be private or not accessible.

    • Solution: Ensure you're using credentials that have access to the content.

Mitigation Strategies

  • Increase INSTAGRAM_MAX_RETRIES and INSTAGRAM_RETRY_DELAY in your .env file
  • Use an Instagram account with fewer restrictions
  • If Instagram integration is critical, consider implementing a browser automation solution (like Selenium)

Note on Instagram's Policies

Instagram actively works to prevent automated access to their platform. The application's ability to download content may be affected by:

  • Instagram's frequent API and website changes
  • Rate limiting and blocking of automated requests
  • Login challenges and captchas when using automated tools

Running the Backend Server (without Docker)

cd video-upload-app
uvicorn app:app --reload

Running the Frontend Development Server (without Docker)

cd video-transcription-frontend
npm start

Building for Production

cd video-transcription-frontend
npm run build

Environment Variables

Set the following environment variables in your .env file:

Variable Description Default
OPENAI_API_KEY Your OpenAI API key required
GOOGLE_API_KEY Your Google API key (if applicable) optional
INSTAGRAM_USERNAME Instagram username for downloading content optional
INSTAGRAM_PASSWORD Instagram password for downloading content optional
INSTAGRAM_MAX_RETRIES Maximum number of retry attempts for Instagram 3
INSTAGRAM_RETRY_DELAY Delay between retry attempts in seconds 2
ALLOWED_ORIGINS Comma-separated list of allowed origins for CORS *
FACT_CHECK_MODEL OpenAI model for fact checking chatgpt-4o-latest
IMAGE_ANALYSIS_MODEL OpenAI model for image analysis gpt-4o-mini
TRANSCRIPTION_MODEL OpenAI model for transcription whisper-1
REACT_APP_MAX_UPLOAD_SIZE Maximum upload size in MB 2500
ALLOWED_FILE_TYPES Comma-separated list of allowed file extensions mp4,mov,avi

API Endpoints

Endpoint Method Description
/upload POST Upload a video for processing
/transcribe POST Transcribe an already uploaded video
/fact-check POST Perform fact-checking on a transcription

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • OpenAI for providing the AI models
  • All contributors who have helped with the project

Contact

About

Application that automatically transcribes and verifies factual claims from videos, Instagram posts, and free-text input using OpenAI’s most advanced models. Designed for seamless, multilingual fact-checking with web-integrated validation and intuitive UX.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published