Skip to content

Commit

Permalink
Yet another CLI fix
Browse files Browse the repository at this point in the history
  • Loading branch information
olokobayusuf committed May 29, 2023
1 parent 156a4e2 commit b983120
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 10 deletions.
7 changes: 5 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
## 0.0.8
+ Fixed `fxn predictors create` CLI command raising authentication error.

## 0.0.7
+ Fix `fxn predictors create` CLI command raising error.
+ Fixed `fxn predictors create` CLI command raising error.

## 0.0.6
+ Fix `fxn predictors create` CLI command raising error.
+ Fixed `fxn predictors create` CLI command raising error.

## 0.0.5
+ Added `Prediction` class for making predictions.
Expand Down
7 changes: 6 additions & 1 deletion fxn/cli/predict.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ def predict (
):
# Predict
inputs = { context.args[i].replace("-", ""): _parse_value(context.args[i+1]) for i in range(0, len(context.args), 2) }
prediction = Prediction.create(tag, **inputs, raw_outputs=raw_outputs, access_key=get_access_key())
prediction = Prediction.create(
tag=tag,
**inputs,
raw_outputs=raw_outputs,
access_key=get_access_key()
)
# Parse results
if hasattr(prediction, "results"):
images = [feature for feature in prediction.results if isinstance(feature, Image.Image)]
Expand Down
25 changes: 20 additions & 5 deletions fxn/cli/predictors.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
def retrieve_predictor (
tag: str=Argument(..., help="Predictor tag.")
):
predictor = Predictor.retrieve(tag, access_key=get_access_key())
predictor = Predictor.retrieve(
tag=tag,
access_key=get_access_key()
)
predictor = asdict(predictor) if predictor else None
print_json(data=predictor)

Expand All @@ -29,7 +32,12 @@ def search_predictors (
offset: int=Option(None, help="Pagination offset."),
count: int=Option(None, help="Pagination count.")
):
predictors = Predictor.search(query=query, offset=offset, count=count, access_key=get_access_key())
predictors = Predictor.search(
query=query,
offset=offset,
count=count,
access_key=get_access_key()
)
predictors = [asdict(predictor) for predictor in predictors]
print_json(data=predictors)

Expand Down Expand Up @@ -57,7 +65,8 @@ def create_predictor (
acceleration=acceleration,
environment=environment,
license=license,
overwrite=overwrite
overwrite=overwrite,
access_key=get_access_key()
)
predictor = asdict(predictor)
print_json(data=predictor)
Expand All @@ -66,14 +75,20 @@ def create_predictor (
def delete_predictor (
tag: str=Argument(..., help="Predictor tag.")
):
result = Predictor.delete(tag, access_key=get_access_key())
result = Predictor.delete(
tag=tag,
access_key=get_access_key()
)
print_json(data=result)

@app.command(name="archive", help="Archive an active predictor.")
def archive_predictor (
tag: str=Argument(..., help="Predictor tag.")
):
predictor = Predictor.archive(tag, access_key=get_access_key())
predictor = Predictor.archive(
tag=tag,
access_key=get_access_key()
)
print_json(data=asdict(predictor))

@app.callback()
Expand Down
5 changes: 4 additions & 1 deletion fxn/cli/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
def retrieve_user (
username: str=Argument(..., help="Username.")
):
user = User.retrieve(username, access_key=get_access_key())
user = User.retrieve(
username=username,
access_key=get_access_key()
)
user = asdict(user) if user else None
print_json(data=user)
2 changes: 1 addition & 1 deletion fxn/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Copyright © 2023 NatML Inc. All Rights Reserved.
#

__version__ = "0.0.7"
__version__ = "0.0.8"

0 comments on commit b983120

Please sign in to comment.