InferIO-X
Inference I/O Extended
Installation
$ pip install inferio-x==0.1.0
Usage
from pydantic import BaseModel
from inferio import Service, Endpoint, Method
class PredictPayload(BaseModel):
name: str
age: int
class Predictor:
def __init__(self, model_f: str) -> None:
self.model_f = model_f
def predict(self, payload: PredictPayload) -> dict: ...
if __name__ == "__main__":
predictor = Predictor(model_f="model.pth")
service = Service(
endpoints=[
Endpoint(path="/", handler=predictor.predict, methods=[Method.POST]),
])
service.run()
Tests
To run the tests, use the following command:
$ poetry run pytest