Simplify boilerplate for learning: stub inference and Postgres write
Removed ort/ndarray/image (ONNX Runtime inference) and sqlx (Postgres audit write). inference::detect() and the Postgres half of reporter::report() are now stubs with a comment for what real code goes there. Redis Streams XREADGROUP loop and the Redis pub/sub alert stay real. Verified with a clean cargo check --all-targets (0 warnings).
This commit is contained in:
+18
-3
@@ -1,4 +1,19 @@
|
||||
mod detector;
|
||||
mod preprocess;
|
||||
use serde::Serialize;
|
||||
|
||||
pub use detector::{Detection, FailureDetector};
|
||||
#[derive(Debug, Clone, Serialize)]
|
||||
pub struct Detection {
|
||||
pub label: String,
|
||||
pub confidence: f32,
|
||||
}
|
||||
|
||||
/// Stand-in for real ONNX Runtime inference (the `ort` crate, using a model
|
||||
/// trained on failure images). Always reports one fixed "failure" so the
|
||||
/// rest of the pipeline — reporting, acking the stream entry — has
|
||||
/// something to do and can be tested without a real model file.
|
||||
///
|
||||
/// Swap this out once you're comfortable with the pipeline around it:
|
||||
/// decode `frame_bytes` with the `image` crate, run it through an `ort`
|
||||
/// session, and turn the model's output into real `Detection`s.
|
||||
pub fn detect(_frame_bytes: &[u8]) -> Vec<Detection> {
|
||||
vec![Detection { label: "spaghetti".to_string(), confidence: 0.91 }]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user