Skip to content

Commit 6eb983b

Browse files
Update README.md
1 parent 3d8710e commit 6eb983b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,21 @@ class SimpleLitAPI(ls.LitAPI):
7878
self.model1 = lambda x: x**2
7979
self.model2 = lambda x: x**3
8080

81+
def decode_request(self, request):
82+
# get inputs to /predict
83+
return request["input"]
84+
8185
def predict(self, x):
86+
# perform calculations using both models
8287
a = self.model1(x)
8388
b = self.model2(x)
8489
c = a + b
8590
return {"output": c}
8691

92+
def encode_response(self, output):
93+
# package outputs from /predict
94+
return {"output": output}
95+
8796
if __name__ == "__main__":
8897
# 12+ features like batching, streaming, etc...
8998
server = ls.LitServer(SimpleLitAPI(max_batch_size=1), accelerator="auto")

0 commit comments

Comments
 (0)