Utilities
Info
For the inference of engines based on multimedia types, we use the singledispatch decorator to simplify the selection process of the appropriate engines. The decorator transforms a function into a generic function that can have different engine implementations depending on the type of the input media.
engine(media)
Engine singledispatch factory. Use the media input to infer the right engine.
Usage:
# create an image type to pass into engine function
image = harvest.image(path=Path("image.jpg"))
engine = processing.engine(image)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
media |
Media[Path]
|
The media type to dispatch |
required |
Returns:
Type | Description |
---|---|
Engine
|
The appropriate engine implementation for the type of media |
Raises:
Type | Description |
---|---|
ProcessingEngineError
|
If any error occurs during engine initialization |
Source code in nucleus/sdk/processing/process.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
|