use serde_json::json;
use std::fs;
fn main() -> Result<(), Box<dyn std::error::Error>> {
let input_size = 3 * 224 * 224;
let sample: Vec<f32> = (0..input_size)
.map(|i| ((i as f32 * 0.001).sin() + 1.0) * 0.5)
.collect();
let single_request = json!({ "input": sample });
let batch_request = json!({
"inputs": [
sample,
sample.iter().map(|x| x * 0.8).collect::<Vec<f32>>(),
sample.iter().map(|x| (x * 1.2).min(1.0)).collect::<Vec<f32>>(),
]
});
fs::write(
"resnet18_single_sample.json",
serde_json::to_string(&single_request)?,
)?;
fs::write(
"resnet18_batch_sample.json",
serde_json::to_string(&batch_request)?,
)?;
println!("✅ Generated ResNet-18 sample data:");
println!(" - resnet18_single_sample.json (single image)");
println!(" - resnet18_batch_sample.json (batch of 3 images)");
println!(" - Input shape: [3, 224, 224] = {input_size} values per image");
Ok(())
}