Configuration
To start using the Serve module you need to first import the packages
from gjirafatech.truai.serve import TruServe, TruRequestModel
After importing the packages you have to initialize an object of the TruServe class and create a class that extends TruRequestModel whose properties will be used in predict function.
from gjirafatech.truai.serve import TruServe, TruRequestModel
class CustomModel(TruServe):
def __init__(self):
super(CustomModel, self).__init__();
class RequestBody(TruRequestModel):
pass
The custom model class that you create must have the implementation of two methods:
load
predict
def load(self):
pass
def predict(self, request: RequestBody):
pass
To deploy this model that you created you can refer to this article.