Skip to content

Commit

Permalink
type variable df
Browse files Browse the repository at this point in the history
  • Loading branch information
mattn committed May 21, 2024
1 parent 818685b commit 7b7b721
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import numpy as np
import bentoml
from pydantic import Field
from bentoml.validators import Shape
from typing_extensions import Annotated
import joblib


Expand All @@ -10,5 +14,10 @@ def __init__(self):
self.model = joblib.load(self.iris_model.path_of("model.pkl"))

@bentoml.api
def predict(self, df):
def predict(
self,
df: Annotated[np.ndarray, Shape((-1, 4))] = Field(
default=[[5.2, 2.3, 5.0, 0.7]]
),
) -> np.ndarray:
return self.artifacts.model.predict(df)

0 comments on commit 7b7b721

Please sign in to comment.