| 47 | |
| 48 | |
| 49 | class TestStreamAPI(ls.LitAPI): |
| 50 | def setup(self, device) -> None: |
| 51 | self.model = None |
| 52 | |
| 53 | def decode_request(self, request): |
| 54 | return request["input"] |
| 55 | |
| 56 | def predict(self, x): |
| 57 | # x is a list of integers |
| 58 | for i in range(4): |
| 59 | yield np.asarray(x) * i |
| 60 | |
| 61 | def encode_response(self, output_stream): |
| 62 | for output in output_stream: |
| 63 | output = list(output) |
| 64 | yield [{"output": o} for o in output] |
| 65 | |
| 66 | |
| 67 | def test_default_batch_unbatch(): |
no outgoing calls
searching dependent graphs…