Skip to main content

OcrModel

Trait OcrModel 

Source
pub trait OcrModel: ModelInfo {
    // Required method
    fn recognize<'life0, 'async_trait>(
        &'life0 self,
        images: Vec<ImageInput>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<OcrResult>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn warmup<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: Sync + 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

A model that recognizes text in images (optical character recognition).

OCR is the document-blind counterpart to DocumentExtractionModel — read text out of an image without interpreting layout. Suited to EasyOCR, PaddleOCR, Tesseract-style models.

Required Methods§

Source

fn recognize<'life0, 'async_trait>( &'life0 self, images: Vec<ImageInput>, ) -> Pin<Box<dyn Future<Output = Result<Vec<OcrResult>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Recognize text in a batch of images.

Returns one OcrResult per input image.

§Errors

Returns an error if the provider rejects an input or fails internally.

Provided Methods§

Source

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

Optional warmup hook. The default is a no-op.

§Errors

Returns an error if the underlying model fails to initialize.

Implementors§