Skip to content

Commit

Permalink
Add fxn.predictions.ready
Browse files Browse the repository at this point in the history
  • Loading branch information
olokobayusuf committed Nov 14, 2024
1 parent 0104657 commit dc5dfe4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 12 additions & 0 deletions fxn/services/prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit dc5dfe4

Please sign in to comment.