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:
2026-08-28 18:23:55 +00:00
parent 94b827613d
commit db5adc9324
12 changed files with 101 additions and 361 deletions
+18 -3
View File
@@ -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 }]
}