EasyOCR¶
About this page
This is an API reference for EasyOCR in BentoML. Please refer to EasyOCR guide for more information about how to use EasyOCR in BentoML.
- bentoml.easyocr.save_model(name: Tag | str, reader: easyocr.Reader, *, signatures: ModelSignaturesType | None = None, labels: dict[str, str] | None = None, custom_objects: dict[str, t.Any] | None = None, external_modules: t.List[ModuleType] | None = None, metadata: dict[str, t.Any] | None = None) bentoml.Model¶
Save a model instance to BentoML modelstore.
- Parameters:
name – Name for given model instance. This should pass Python identifier check.
reader – The EasyOCR model to be saved. Currently only supports pre-trained models from easyocr. Custom models are not yet supported.
signatures – Methods to expose for running inference on the target model. Signatures are used for creating
Runnerinstances when serving model withServicelabels – User-defined labels for managing models, e.g.
team=nlp,stage=dev.custom_objects – Custom objects to be saved with the model. An example is
{"my-normalizer": normalizer}. Custom objects are currently serialized with cloudpickle, but this implementation is subject to change.external_modules – user-defined additional python modules to be saved alongside the model or custom objects, e.g. a tokenizer module, preprocessor module, model configuration module
metadata – Custom metadata for given model.
- Returns:
A
tagwith a formatname:versionwherenameis the user-defined model’s name, and a generatedversion.- Return type:
Tag
Examples:
import bentoml import easyocr reader = easyocr.Reader(['en']) bento_model = bentoml.easyocr.save_model('en_reader', reader)
- bentoml.easyocr.load_model(bento_model: str | Tag | Model) easyocr.Reader¶
Load the EasyOCR model from BentoML local model store with given name.
- Parameters:
bento_model – Either the tag of the model to get from the store, or a BentoML
Modelinstance to load the model from.- Returns:
The EasyOCR model from the model store.
- Return type:
easyocr.Reader
Example:
import bentoml reader = bentoml.easyocr.load_model('en_reader:latest')
- bentoml.easyocr.get(tag_like: str | Tag) Model¶
Get the BentoML model with the given tag.
- Parameters:
tag_like – The tag of the model to retrieve from the model store.
- Returns:
A BentoML
Modelwith the matching tag.- Return type:
Model
Example:
import bentoml # target model must be from the BentoML model store model = bentoml.easyocr.get("en_reader:latest")