Skip to content

Commit

Permalink
feat: make quickstart batchable (#3172)
Browse files Browse the repository at this point in the history
Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com>
  • Loading branch information
sauyon and aarnphm committed Nov 2, 2022
1 parent b67bd20 commit 0e8b7b8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion examples/quickstart/service.py
Expand Up @@ -9,7 +9,9 @@


@svc.api(
input=NumpyNdarray.from_sample(np.array([[4.9, 3.0, 1.4, 0.2]], dtype=np.double)),
input=NumpyNdarray.from_sample(
np.array([[4.9, 3.0, 1.4, 0.2]], dtype=np.double), enforce_shape=False
),
output=NumpyNdarray(),
)
async def classify(input_series: np.ndarray) -> np.ndarray:
Expand Down
4 changes: 3 additions & 1 deletion examples/quickstart/train.py
Expand Up @@ -18,5 +18,7 @@
clf.fit(X, y)

# Save model to BentoML local model store
saved_model = bentoml.sklearn.save_model("iris_clf", clf)
saved_model = bentoml.sklearn.save_model(
"iris_clf", clf, signatures={"predict": {"batchable": True, "batch_dim": 0}}
)
print(f"Model saved: {saved_model}")

0 comments on commit 0e8b7b8

Please sign in to comment.