ImageCaptioner

Trait ImageCaptioner 

Source
pub trait ImageCaptioner: Send + Sync {
    // Required methods
    fn init<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), CaptionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn caption<'life0, 'life1, 'async_trait>(
        &'life0 self,
        image_data: &'life1 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<Option<String>, CaptionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn is_initialized<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn model_name(&self) -> &str;
}
Expand description

Trait for vision-based image captioning.

Required Methods§

Source

fn init<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), CaptionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Initialize the captioner (load model, etc.).

Source

fn caption<'life0, 'life1, 'async_trait>( &'life0 self, image_data: &'life1 [u8], ) -> Pin<Box<dyn Future<Output = Result<Option<String>, CaptionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Generate a caption for image bytes.

Source

fn is_initialized<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Check if the captioner is initialized.

Source

fn model_name(&self) -> &str

Get the model name.

Implementors§