devo_ml.modelmanager.downloader
#
Available downloaders to store model files.
- get_default_downloader()[source]#
Returns the default downloader used.
- Return type:
- Returns:
The default downloader
- get_image_bytes(image)[source]#
Gets the bytes of an image.
An image must have the image key with the base 64 encoded image.
- Parameters:
image (
dict
) – The image to get bytes- Raises:
ValueError – if no image key or image key is empty.
- Return type:
- Returns:
The bytes of the image
- class Downloader[source]#
An interface to downloaders.
Any downloader must be a callable with the
DownloaderCallable
signature, receiving a model and returns an identification of the download of the model as a string.
- class FileSystemDownloader(path)[source]#
A downloader capable of writing file of model to the file system.
- __init__(path)[source]#
Creates a
FileSystemDownloader
object.- Parameters:
path (str | Path) – The path where files will be written
- __call__(model)[source]#
Downloads the file associated with the model and writes it in downloader path.
The file name will be the model name plus the inferred extension from the engine. The extension will be empty if it can not infer, e.g: if there is no extension associated to the engine.
- Parameters:
model (
dict
) – The model to download its file- Raises:
ValueError – If model has invalid or empty keys for name, engine or image
OSError – If there is a problem writing the file to path
- Return type:
- Returns:
The absolute path of file written