Skip to main content

A powerful open source library for detecting deepfakes and AI-generated content.

Project description

🛡️ Defakepy: Open Source Deepfake & AI Detection Library

License: MIT Python: 3.10+

Defakepy is a powerful open-source forensic suite designed to detect AI-generated content across text, audio, and video. It provides a deterministic and statistical "Trust Score" to help verify digital reality.


✨ Key Features

  • Text Forensics: Analyzes Perplexity and Burstiness to detect LLM-generated prose (GPT-4, Llama 3, Claude 3.5).
  • Video Biological Tells: Uses Computer Vision to track Eye Aspect Ratio (EAR) for unnatural blinking patterns.
  • Audio Spectral Analysis: Detects "robotic" frequency signatures in cloned voices using Mel-Frequency Cepstral Coefficients (MFCCs).
  • C2PA Metadata: Native support for reading digital provenance signatures and manifests.
  • Lazy Loading: High-performance CLI that only loads heavy ML models on demand.

🚀 Quick Start

Installation

Install the core library via pip:

pip install defakepy

To include support for C2PA provenance and digital signatures (requires ~90MB download):

pip install "defakepy[provenance]"

To include support for Video/Vision analysis (requires dlib and CMake on Windows):

pip install "defakepy[vision]"

🛠️ Troubleshooting

Installation Timeout (ReadTimeoutError)

If you encounter a ReadTimeoutError during installation, it's usually due to a slow network connection while downloading large dependencies (like torch or c2pa-python). You can increase the timeout limit:

pip install --default-timeout=1000 defakepy

dlib Installation Failure (Windows)

If installing defakepy[vision] fails while building dlib, it's likely because CMake is missing.

  1. Download CMake from cmake.org.
  2. Run the installer and ensure you select "Add CMake to the system PATH".
  3. Restart your terminal and try again.

Basic Usage (CLI)

Scan any file directly from your terminal:

defakepy-scan --input suspicious_video.mp4

Python API

Integrate Defakepy into your own application:

from defakepy import ForensicScanner

scanner = ForensicScanner()
report = scanner.scan_file("document.pdf")

print(f"Trust Score: {report['trust_score']}/100")

📊 How it Works

Defakepy uses an Ensemble Approach:

  1. Statistical Layer: Checks for patterns AI cannot easily hide (rhythm, entropy).
  2. Biological Layer: Checks for human-specific involuntary movements (blinking).
  3. Cryptographic Layer: Verifies digital watermarks and C2PA signatures.

⚖️ Legal & Ethical Disclaimer: Detection is probabilistic, not absolute. Defakepy is a tool to assist human verification, not replace it.

🤝 Contributing: We welcome contributions! Please see CONTRIBUTING.md for details.

📄 License: Distributed under the MIT License. See LICENSE for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

defakepy-0.1.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

defakepy-0.1.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file defakepy-0.1.3.tar.gz.

File metadata

  • Download URL: defakepy-0.1.3.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for defakepy-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3c102b9d54d5689d7e12219c773816182196868b5243b41853d7f8b49cacdf7f
MD5 82546f976da7d09cdd36833aa55c0eb4
BLAKE2b-256 8f775ecb6159190eedf21c58464ad37caa014d7280d968d7f60a7465ea602a99

See more details on using hashes here.

File details

Details for the file defakepy-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: defakepy-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for defakepy-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a2b9f79e03c9b50d6417e1d98fbb188b87283fbe3d9adafe5c09a8f12e7e406a
MD5 8e0e70a2a8486c52613c2ecce6416269
BLAKE2b-256 941a02c6ad2e7a219ca0cb678e63eb8ccdb07836156d68b26ed3022317ce1fe9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page