Skip to main content

rave_core/
backend.rs

1//! Upscale backend trait — the GPU-only inference contract.
2
3use async_trait::async_trait;
4
5use crate::error::Result;
6use crate::types::GpuTexture;
7
8/// Metadata extracted from an ONNX model's input/output tensor descriptors.
9#[derive(Clone, Debug)]
10pub struct ModelMetadata {
11    pub name: String,
12    pub scale: u32,
13    pub input_name: String,
14    pub output_name: String,
15    pub input_channels: u32,
16    pub min_input_hw: (u32, u32),
17    pub max_input_hw: (u32, u32),
18}
19
20/// GPU-only super-resolution inference backend.
21#[async_trait]
22pub trait UpscaleBackend: Send + Sync {
23    async fn initialize(&self) -> Result<()>;
24    async fn process(&self, input: GpuTexture) -> Result<GpuTexture>;
25    async fn shutdown(&self) -> Result<()>;
26    fn metadata(&self) -> Result<&ModelMetadata>;
27}