Expand description
File-type detection using Magika and Burn.
§Example
use akuna_infer::Session;
use burn_wgpu::{Wgpu, WgpuDevice};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let device = WgpuDevice::default();
let mut session = Session::<Wgpu>::new(&device)?;
let detected = session.identify_content_sync(b"fn main() { println!(\"hi\"); }")?;
println!("{} {}", detected.info().label, detected.info().mime_type);
Ok(())
}Structs§
- Detection
- Inferred
Type - Content type identified using AI.
- Magika
Model - Model
Config - Ranked
Alternative - Session
- Type
Info - File type information.
Enums§
- Content
Type - Content types for regular files.
- Error
- File
Type - File types.
- Magika
Inference Error - Overwrite
Reason - Reason to overwrite an inferred content type.
Constants§
- MODEL_
MAJOR_ VERSION - Model major version.
- MODEL_
NAME - Model name (only comparable with equality).
Functions§
- preprocess_
bytes - Legacy helper kept for callers that still want a normalized head/tail feature vector.