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§
- Analysis
Result - Result of an analysis
- Batch
Options - Options for batch processing
- Client
- Client for interacting with the Reality Defender API
- Config
- Configuration for the Reality Defender client
- Detection
Model - Model-specific detection results
- GetResult
Options - Options for getting a result
- Results
Summary - Summary of analysis results
- Upload
Options - Options for uploading a file
- Upload
Result - Result of an upload operation
Enums§
- Error
- Error types for the Reality Defender SDK
Type Aliases§
- Result
- Custom result type for the SDK