Crate realitydefender

Source
Expand description

§Reality Defender SDK

The Reality Defender SDK provides tools for detecting deepfakes and manipulated media through the Reality Defender API.

§Example

use realitydefender::{Client, Config, UploadOptions};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Initialize with API key
    let client = Client::new(Config {
        api_key: std::env::var("REALITY_DEFENDER_API_KEY")?,
        ..Default::default()
    })?;

    // Upload a file for analysis
    let upload_result = client.upload(UploadOptions {
        file_path: "./image.jpg".to_string(),
        metadata: None,
    }).await?;

    // Get the analysis result
    let result = client.get_result(&upload_result.request_id, None).await?;
     
    println!("Status: {}", result.status);
    if let Some(score) = result.score {
        println!("Score: {:.4} ({:.1}%)", score, score * 100.0);
    }

    Ok(())
}

Structs§

AnalysisResult
Result of an analysis
BatchOptions
Options for batch processing
Client
Client for interacting with the Reality Defender API
Config
Configuration for the Reality Defender client
DetectionModel
Model-specific detection results
GetResultOptions
Options for getting a result
ResultsSummary
Summary of analysis results
UploadOptions
Options for uploading a file
UploadResult
Result of an upload operation

Enums§

Error
Error types for the Reality Defender SDK

Type Aliases§

Result
Custom result type for the SDK