Skip to content

Yogesh1290/huminify-c2pa-detector

Repository files navigation

πŸ” Huminify - Ai content detector powered by C2PA

AI Content Detector with C2PA Verification

Verify content authenticity and detect AI-generated media using C2PA technology

License: MIT Python 3.8+ Node.js 18+ TypeScript Open Source

Live Demo β€’ Documentation β€’ Report Bug β€’ Request Feature


πŸŽ₯ Video Tutorial

Huminify Demo Video

▢️ Watch Full Demo on YouTube - Learn how to use Huminify, see live detection examples, and understand C2PA technology.


πŸ“– Table of Contents


🎯 About

Huminify is a comprehensive AI content detection system that uses C2PA (Coalition for Content Provenance and Authenticity) technology to verify the authenticity of images and videos. It helps you determine if content was AI-generated or human-created by analyzing embedded Content Credentials.

Why Huminify?

  • βœ… 100% Free & Open Source - No hidden costs, fully transparent
  • βœ… C2PA Verified - Industry-standard content authenticity
  • βœ… Multi-Platform Support - Detects OpenAI, Google, Adobe, Microsoft
  • βœ… Dual Implementation - Python (full-featured) & TypeScript (lightweight)
  • βœ… Easy Integration - REST API, CLI, and Next.js web app
  • βœ… Production Ready - Clean architecture, well-documented

🌟 Features

πŸ” 3-Layer Detection System

Layer 1: C2PA API Verification (Priority)

  • Local FastAPI server for C2PA manifest validation
  • Extracts comprehensive metadata (creator, company, software, certificates)
  • Detects 30+ AI generators
  • Works for images and videos

Layer 2: Embedded C2PA Reading

  • Direct file reading using c2pa-python library
  • Works offline without API
  • Handles invalid/expired signatures with raw data extraction
  • Works for images and videos

Layer 3: AI Model Detection (Fallback)

  • Image AI detection using Hugging Face models
  • Provides confidence scores when C2PA unavailable
  • ~70-85% accuracy (use with caution)
  • Images only - not available for videos

🎨 Supported Content Types

Type Formats C2PA Detection AI Fallback
Images PNG, JPEG, WebP, HEIC, AVIF βœ… βœ…
Videos MP4, MOV, AVI, WebM, MKV βœ… ❌

🏒 Supported Platforms

Working C2PA Implementations:

  • βœ… Adobe Firefly (images)
  • βœ… Adobe Premiere Pro (videos)
  • βœ… OpenAI ChatGPT/DALL-E (images)
  • βœ… OpenAI Sora (videos)
  • βœ… Microsoft Designer (images)
  • βœ… Google Gemini (images)
  • βœ… Google Pixel Camera (images)

200+ C2PA Coalition Members (various implementation stages)


🎬 Demo

Web Application

Visit our live demo: huminify.vercel.app

CLI Demo

$ python bin/detector.py examples/ChatGPT_Image.png

🌐 C2PA API: ai_confirmed_api
   πŸ€– AI GENERATION DETECTED!
   Software: ChatGPT
   Organization: OpenAI
   Certificate: Truepic Lens CLI in Sora
   AI Assertions: AI Generator: ChatGPT

🎯 VERDICT: AI_DETECTED_C2PA_API
   Confidence: HIGH

πŸš€ Quick Start

Choose Your Version

Version Best For Features
Python Full-featured detection C2PA + AI models, CLI, API server
TypeScript Lightweight & serverless C2PA only, Express, Next.js
Next.js Web App End users Beautiful UI, drag-and-drop, instant results

Python Version (Recommended)

# 1. Clone the repository
git clone https://github.com/Yogesh1290/huminify-c2pa-detector.git
cd huminify-c2pa-detector

# 2. Run setup
setup.bat  # Windows
# or
./setup.sh  # Linux/Mac

# 3. Analyze content
run.bat examples/ChatGPT_Image.png  # Windows
# or
./run.sh examples/ChatGPT_Image.png  # Linux/Mac

TypeScript Version

# Navigate to TypeScript directory
cd typescript-api

# Install dependencies
npm install

# Start server
npm start

# Test API
curl -X POST http://localhost:3000/api/detect \
  -F "file=@../examples/test.png"

Next.js Web App

# Navigate to Next.js app
cd typescript-api/example-nextjs-app

# Install dependencies
npm install

# Start development server
npm run dev

# Open browser
# Visit http://localhost:3000

πŸ“¦ Installation

Prerequisites

For Python Version:

  • Python 3.8 or higher
  • pip (Python package manager)
  • 2GB+ RAM (for AI models)

For TypeScript Version:

  • Node.js 18 or higher
  • npm or yarn
  • 500MB+ RAM

Detailed Installation

Python Setup

# Clone repository
git clone https://github.com/Yogesh1290/huminify-c2pa-detector.git
cd huminify-c2pa-detector

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# Linux/Mac:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Verify installation
python verify_setup.py

TypeScript Setup

# Navigate to TypeScript directory
cd typescript-api

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

# Install C2PA CLI (required)
npm install -g @contentauth/c2pa-node

# Start server
npm start

Next.js Web App Setup

# Navigate to Next.js app
cd typescript-api/example-nextjs-app

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

πŸ’» Usage

Python CLI

Basic Usage

# Activate virtual environment (one-time per session)
activate.bat  # Windows
# or
source venv/bin/activate  # Linux/Mac

# Analyze image
python bin/detector.py image.png

# Analyze video
python bin/detector.py video.mp4

# Start API server
python bin/server.py

Using Batch Files (Windows)

# Easiest way - no activation needed
run.bat examples/test.png
start_api_server.bat

Python API Server

# Start server
python bin/server.py

# Server runs at http://localhost:8000
# API docs at http://localhost:8000/docs

API Endpoints:

  • POST /validate/file - Upload file for validation
  • POST /validate/base64 - Validate base64-encoded data
  • POST /validate/url - Validate file from URL
  • GET /health - Health check
  • GET /docs - Interactive API documentation

TypeScript API

# Start Express server
cd typescript-api
npm start

# Server runs at http://localhost:3000

API Endpoint:

# Detect AI content
curl -X POST http://localhost:3000/api/detect \
  -F "file=@image.png"

Response:

{
  "success": true,
  "data": {
    "file": "image.png",
    "fileType": "image/png",
    "c2paStatus": "FOUND",
    "verdict": "AI_DETECTED_C2PA",
    "confidence": "HIGH",
    "platform": "openai",
    "company": "OpenAI",
    "c2paInfo": {
      "aiGenerated": true,
      "signatureValid": true,
      "software": "DALL-E 3",
      "organization": "OpenAI"
    }
  }
}

Next.js Web Application

# Development
cd typescript-api/example-nextjs-app
npm run dev
# Visit http://localhost:3000

# Production build
npm run build
npm start

# Deploy to Vercel
vercel deploy

Integration Examples

React/Next.js

import { useState } from 'react';

function AIDetector() {
  const [result, setResult] = useState(null);

  const handleUpload = async (file: File) => {
    const formData = new FormData();
    formData.append('file', file);

    const response = await fetch('/api/detect', {
      method: 'POST',
      body: formData,
    });

    const data = await response.json();
    setResult(data);
  };

  return (
    <div>
      <input type="file" onChange={(e) => handleUpload(e.target.files[0])} />
      {result && <div>Verdict: {result.data.verdict}</div>}
    </div>
  );
}

Python

import requests

with open('image.jpg', 'rb') as f:
    files = {'file': f}
    response = requests.post(
        'http://localhost:8000/validate/file',
        files=files
    )
    
result = response.json()
print(result)

Node.js

const FormData = require('form-data');
const fs = require('fs');
const axios = require('axios');

const formData = new FormData();
formData.append('file', fs.createReadStream('image.jpg'));

axios.post('http://localhost:3000/api/detect', formData, {
  headers: formData.getHeaders()
})
.then(response => console.log(response.data))
.catch(error => console.error(error));

πŸ“ Project Structure

huminify-c2pa-detector/
β”œβ”€β”€ πŸ“‚ bin/                          # Entry point scripts
β”‚   β”œβ”€β”€ detector.py                  # CLI detector
β”‚   └── server.py                    # API server
β”‚
β”œβ”€β”€ πŸ“‚ src/                          # Python source code
β”‚   β”œβ”€β”€ πŸ“‚ api/                      # FastAPI server
β”‚   β”‚   β”œβ”€β”€ server.py               # App initialization
β”‚   β”‚   β”œβ”€β”€ routes.py               # Route handlers
β”‚   β”‚   └── models.py               # Request/response models
β”‚   β”œβ”€β”€ πŸ“‚ core/                     # Core detection logic
β”‚   β”‚   β”œβ”€β”€ detector.py             # Main orchestrator
β”‚   β”‚   β”œβ”€β”€ c2pa_reader.py          # C2PA reading
β”‚   β”‚   └── api_client.py           # API communication
β”‚   β”œβ”€β”€ πŸ“‚ models/                   # AI detection models
β”‚   β”‚   └── image_detector.py       # Image AI detection
β”‚   β”œβ”€β”€ πŸ“‚ platforms/                # Platform extractors
β”‚   β”‚   β”œβ”€β”€ base.py                 # Base class
β”‚   β”‚   β”œβ”€β”€ registry.py             # Platform registry
β”‚   β”‚   β”œβ”€β”€ openai.py               # OpenAI extractor
β”‚   β”‚   β”œβ”€β”€ google.py               # Google extractor
β”‚   β”‚   β”œβ”€β”€ adobe.py                # Adobe extractor
β”‚   β”‚   β”œβ”€β”€ microsoft.py            # Microsoft extractor
β”‚   β”‚   └── TEMPLATE.py             # New platform template
β”‚   └── πŸ“‚ utils/                    # Utilities
β”‚       └── console.py              # Console formatting
β”‚
β”œβ”€β”€ πŸ“‚ typescript-api/               # TypeScript version
β”‚   β”œβ”€β”€ πŸ“‚ src/                      # TypeScript source
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ config/              # Configuration
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ services/            # Business logic
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ routes/              # Express routes
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ types/               # TypeScript types
β”‚   β”‚   └── πŸ“‚ utils/               # Utilities
β”‚   β”œβ”€β”€ πŸ“‚ example-nextjs-app/      # Next.js web application
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ pages/               # Next.js pages
β”‚   β”‚   β”‚   β”œβ”€β”€ index.tsx           # Home page
β”‚   β”‚   β”‚   β”œβ”€β”€ docs.tsx            # Documentation
β”‚   β”‚   β”‚   └── πŸ“‚ api/             # API routes
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ components/          # React components
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ lib/                 # Client libraries
β”‚   β”‚   β”œβ”€β”€ πŸ“‚ styles/              # CSS styles
β”‚   β”‚   └── πŸ“‚ public/              # Static assets
β”‚   β”œβ”€β”€ package.json
β”‚   └── README.md
β”‚
β”œβ”€β”€ πŸ“‚ docs/                         # Documentation
β”‚   β”œβ”€β”€ QUICK_START.md
β”‚   β”œβ”€β”€ SETUP_INSTRUCTIONS.md
β”‚   β”œβ”€β”€ C2PA_COMPANIES_2025.md
β”‚   └── ENHANCED_METADATA.md
β”‚
β”œβ”€β”€ πŸ“‚ examples/                     # Test images/videos
β”‚   β”œβ”€β”€ ChatGPT_Image.png
β”‚   β”œβ”€β”€ test2.png
β”‚   └── videotest.mp4
β”‚
β”œβ”€β”€ πŸ“‚ tools/                        # Utility scripts
β”‚   β”œβ”€β”€ extract_c2pa_raw.py
β”‚   β”œβ”€β”€ inspect_manifest.py
β”‚   └── download_test_images.py
β”‚
β”œβ”€β”€ requirements.txt                 # Python dependencies
β”œβ”€β”€ setup.bat                        # Windows setup
β”œβ”€β”€ run.bat                          # Quick run script
β”œβ”€β”€ activate.bat                     # Activate venv
β”œβ”€β”€ README.md                        # This file
β”œβ”€β”€ ARCHITECTURE.md                  # Architecture docs
β”œβ”€β”€ CONTRIBUTING.md                  # Contribution guide
β”œβ”€β”€ CHANGELOG.md                     # Version history
└── LICENSE                          # MIT License

πŸ“š API Documentation

Python API Endpoints

Base URL: http://localhost:8000

POST /validate/file

Upload a file for C2PA validation.

Request:

curl -X POST http://localhost:8000/validate/file \
  -F "file=@image.png"

Response:

{
  "status": "ai_confirmed_api",
  "verdict": "AI_DETECTED_C2PA_API",
  "confidence": "high",
  "metadata": {
    "company": "OpenAI",
    "software": "ChatGPT",
    "ai_generated": true
  }
}

POST /validate/base64

Validate base64-encoded content.

POST /validate/url

Validate content from URL.

GET /health

Health check endpoint.

GET /docs

Interactive API documentation (Swagger UI).

TypeScript API Endpoints

Base URL: http://localhost:3000

POST /api/detect

Detect AI-generated content.

Request:

curl -X POST http://localhost:3000/api/detect \
  -F "file=@image.png"

Response:

{
  "success": true,
  "data": {
    "file": "image.png",
    "verdict": "AI_DETECTED_C2PA",
    "confidence": "HIGH",
    "platform": "openai",
    "c2paInfo": {
      "aiGenerated": true,
      "signatureValid": true
    }
  }
}

GET /api/health

Health check endpoint.

GET /api/platforms

List supported platforms.


🏒 Supported Platforms

Fully Implemented

Platform Type Status C2PA Support
OpenAI ChatGPT, DALL-E, Sora βœ… Working Full
Adobe Firefly, Premiere Pro βœ… Working Full
Google Gemini, Pixel Camera βœ… Working Full
Microsoft Designer βœ… Working Full

Adding New Platforms

Want to add support for a new platform? It's easy!

  1. Copy the template:
cp src/platforms/TEMPLATE.py src/platforms/newplatform.py
  1. Implement the extractor:
class NewPlatformExtractor(BasePlatformExtractor):
    def __init__(self):
        self.company_name = "NewPlatform"
        self.markers = ["NewPlatform", "NP"]
        self.ai_indicators = ["ai_generated"]
    
    def extract_metadata(self, manifest, raw_data):
        metadata = {
            "company": self.company_name,
            "detected_markers": self.search_raw_data(raw_data)
        }
        return metadata
    
    def is_ai_generated(self, metadata):
        return len(metadata.get("detected_markers", [])) > 0
  1. Register in registry:
# src/platforms/registry.py
from .newplatform import NewPlatformExtractor

class PlatformRegistry:
    def __init__(self):
        self.extractors = {
            "openai": OpenAIExtractor(),
            "google": GoogleExtractor(),
            "adobe": AdobeExtractor(),
            "microsoft": MicrosoftExtractor(),
            "newplatform": NewPlatformExtractor()  # Add here
        }
  1. Test and submit PR!

See src/platforms/README.md for detailed guide.


🀝 Contributing

We love contributions! Huminify is open source and community-driven.

Ways to Contribute

  • πŸ› Report bugs - Found an issue? Open a bug report
  • ✨ Suggest features - Have an idea? Request a feature
  • πŸ“ Improve docs - Help make our documentation better
  • πŸ”§ Submit PRs - Fix bugs or add features
  • ⭐ Star the repo - Show your support!

Development Setup

# Fork and clone
git clone https://github.com/YOUR_USERNAME/huminify-c2pa-detector.git
cd huminify-c2pa-detector

# Create branch
git checkout -b feature/amazing-feature

# Make changes and test
python bin/detector.py examples/test.png

# Commit and push
git commit -m "Add amazing feature"
git push origin feature/amazing-feature

# Open Pull Request

Contribution Guidelines

  1. Code Style

    • Python: Follow PEP 8
    • TypeScript: Follow ESLint rules
    • Add comments for complex logic
  2. Testing

    • Test your changes thoroughly
    • Include test cases if applicable
  3. Documentation

    • Update README if needed
    • Add docstrings to functions
    • Update CHANGELOG.md
  4. Commit Messages

    • Use clear, descriptive messages
    • Format: type: description
    • Examples: feat: add video support, fix: resolve API error

See CONTRIBUTING.md for detailed guidelines.


πŸ—ΊοΈ Roadmap

Version 2.1 (Current)

  • βœ… Python implementation with 3-layer detection
  • βœ… TypeScript/Express API
  • βœ… Next.js web application
  • βœ… Image and video support
  • βœ… Multi-platform detection

Version 2.2 (In Progress)

  • πŸ”„ Docker containerization
  • πŸ”„ Batch processing support
  • πŸ”„ Database integration
  • πŸ”„ Enhanced error handling

Version 3.0 (Planned)

  • πŸ“‹ Audio file support
  • πŸ“‹ PDF document support
  • πŸ“‹ Advanced analytics dashboard
  • πŸ“‹ REST API client libraries
  • πŸ“‹ Webhook support
  • πŸ“‹ Cloud deployment guides

Future Ideas

  • Mobile app (React Native)
  • Browser extension
  • WordPress plugin
  • Zapier integration
  • Enterprise features

Have a feature request? Open an issue!


⚠️ Limitations & Reality Check

C2PA Adoption Status

Current Reality (Feb 2025):

  • Only 4-5 tools have full C2PA implementation
  • Most images on the internet don't have C2PA metadata
  • Popular tools like Midjourney don't support C2PA yet
  • Older content lacks C2PA (standard is relatively new)

What This Means:

  • βœ… High accuracy when C2PA is present
  • ⚠️ Limited coverage - most content won't have C2PA
  • πŸ”„ Growing adoption - more tools adding support

AI Model Limitations

Image Detection (Layer 3):

  • ~70-85% accuracy
  • Best used as fallback when C2PA unavailable
  • Not 100% reliable
  • Can produce false positives/negatives

Text Detection:

  • ❌ Not supported - fundamentally unreliable
  • Even OpenAI shut down their text detector
  • Different models give contradictory results

Best Practices

  1. Trust C2PA first - Most reliable when available
  2. Use AI models as fallback - Not primary detection
  3. Verify critical content - Don't rely solely on automated detection
  4. Stay updated - C2PA adoption is growing

See docs/REALITY_CHECK.md for detailed analysis.


πŸ“„ License

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

What This Means

βœ… You can:

  • Use commercially
  • Modify the code
  • Distribute
  • Use privately

❌ You cannot:

  • Hold liable
  • Use trademark

πŸ“‹ You must:

  • Include license and copyright notice
  • State changes made

πŸ™ Acknowledgments

Technologies

Organizations

  • Content Authenticity Initiative (CAI) - Leading C2PA adoption
  • 200+ C2PA Coalition Members - Building the future of content authenticity

Community

  • All contributors who have helped improve this project
  • Users who report bugs and suggest features
  • Everyone working towards content authenticity

πŸ“ž Support & Contact

Get Help

Resources


🌟 Show Your Support

If you find Huminify useful, please consider:

  • ⭐ Star this repository on GitHub
  • 🐦 Share on social media - Help spread the word
  • πŸ“ Write a blog post - Share your experience
  • 🀝 Contribute - Submit PRs or report issues
  • πŸ’¬ Provide feedback - Tell us what you think

Made with ❀️ for content authenticity and transparency

⬆ Back to Top

GitHub stars GitHub forks GitHub watchers

Star ⭐ this repo if you find it useful!

About

Upload images or videos to verify their authenticity using C2PA Content Credentials. Detect AI-generated content from ChatGPT, DALL-E, Google Gemini, Adobe Firefly, and more.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors