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 [source]#
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
Runner
instances when serving model withService
labels β 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
tag
with a formatname:version
wherename
is the user-defined modelβs name, and a generatedversion
.- Return type:
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 [source]#
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
Model
instance 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 [source]#
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
Model
with the matching tag.- Return type:
Example:
import bentoml # target model must be from the BentoML model store model = bentoml.easyocr.get("en_reader:latest")