use crate::bindings;
use crate::bindings::core;
use crate::instance::InstanceState;
use crate::model::Command;
use crate::object::IdRepr;
use wasmtime::component::Resource;
use wasmtime_wasi::p2::IoView;
impl bindings::pie::inferlet::input_image::Host for InstanceState {
async fn embed_image(
&mut self,
queue: Resource<core::Queue>,
emb_ids: Vec<IdRepr>,
image_blob: Vec<u8>,
_position_offset: u32, ) -> anyhow::Result<()> {
let inst_id = self.id();
let q = self.table().get(&queue)?;
Command::EmbedImage {
inst_id,
stream_id: q.stream_id,
embs: emb_ids,
image_blob,
}
.dispatch(q.service_id)?;
Ok(())
}
async fn calculate_embed_size(
&mut self,
_queue: Resource<core::Queue>,
_image_width: u32,
_image_height: u32,
) -> anyhow::Result<u32> {
Ok(1024) }
}