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§
Sourcefn init<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), CaptionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
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.).
Sourcefn 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 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.
Sourcefn is_initialized<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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,
Check if the captioner is initialized.
Sourcefn model_name(&self) -> &str
fn model_name(&self) -> &str
Get the model name.