Skip to main content

akuna_infer/
lib.rs

1//! File-type detection using Magika and Burn.
2//!
3//! # Example
4//!
5//! ```rust,no_run
6//! use akuna_infer::Session;
7//! use burn_wgpu::{Wgpu, WgpuDevice};
8//!
9//! fn main() -> Result<(), Box<dyn std::error::Error>> {
10//!     let device = WgpuDevice::default();
11//!     let mut session = Session::<Wgpu>::new(&device)?;
12//!
13//!     let detected = session.identify_content_sync(b"fn main() { println!(\"hi\"); }")?;
14//!     println!("{} {}", detected.info().label, detected.info().mime_type);
15//!
16//!     Ok(())
17//! }
18//! ```
19
20mod config;
21mod content {
22    pub use crate::vendor::content::*;
23}
24mod detection;
25mod file;
26mod model;
27mod preprocess;
28mod session;
29mod vendor;
30
31pub use config::ModelConfig;
32pub use detection::{Detection, RankedAlternative};
33pub use file::{FileType, InferredType, OverwriteReason, TypeInfo};
34pub use model::MagikaInferenceError as Error;
35pub use model::{MagikaInferenceError, MagikaModel};
36pub use preprocess::preprocess_bytes;
37pub use session::Session;
38pub use vendor::content::{ContentType, MODEL_MAJOR_VERSION, MODEL_NAME};