diff --git a/Changelog.md b/Changelog.md index 86e61d2..d52fcf1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,6 @@ ## 0.0.41 + Added support for streaming predictions. ++ Added `fxn.predictions.ready` to check whether a predictor has been preloaded. + Added `verbose` parameter in `fxn.predictions.create` method to print prediction progress. + Added `--quiet` option in `fxn predict` CLI action to suppress verbose logging. + Fixed prediction errors when making passing in `str`, `list`, or `dict` arguments. diff --git a/fxn/services/prediction.py b/fxn/services/prediction.py index 69a8d15..5a1ff5d 100644 --- a/fxn/services/prediction.py +++ b/fxn/services/prediction.py @@ -30,6 +30,18 @@ def __init__ (self, client: FunctionClient): self.__cache_dir = self.__class__.__get_home_dir() / ".fxn" / "cache" self.__cache_dir.mkdir(parents=True, exist_ok=True) + def ready (self, tag: str, **kwargs) -> bool: + """ + Check whether a predictor has been preloaded and is ready to make predictions. + + Parameters: + tag (str): Predictor tag. + + Returns: + bool: Whether the predictor is ready to make predictions. + """ + return tag in self.__cache + def create ( self, tag: str,