Hi,
I am having some problems with PandasCodec and grpc requests.
On the client side, I have the following code to send a pandas df:
data = pd.DataFrame(data={'col1': ["test_string", "test_string"], 'col2': ["test_string", "test_string"]})
i_request = PandasCodec.encode_request(data)
i_request.parameters = types.Parameters(content_type="pd")
inference_request_g = converters.ModelInferRequestConverter.from_types(
i_request, model_name=model_name, model_version=None
)
grpc_channel = grpc.insecure_channel("localhost:8081")
grpc_stub = dataplane.GRPCInferenceServiceStub(grpc_channel)
response = grpc_stub.ModelInfer(inference_request_g)
And I have this code fragment to receive it on the server side:
async def predict(self, payload: types.InferenceRequest) -> types.InferenceResponse:
if payload.parameters.content_type == "pd":
inference_data = PandasCodec.decode_request(payload)
print(inference_data)
I get this output:
col1 col2
0 b'test_string' b'test_string'
1 b'test_string' b'test_string'
The same dataframe, but with binary strings. I was expecting to get as a result the same dataframe that I have in the client, since I am using the same codec for encoding and decoding.
Is this an expected behavior? Maybe I am doing something wrong?
Thanks for your help.
Hi,
I am having some problems with PandasCodec and grpc requests.
On the client side, I have the following code to send a pandas df:
And I have this code fragment to receive it on the server side:
I get this output:
The same dataframe, but with binary strings. I was expecting to get as a result the same dataframe that I have in the client, since I am using the same codec for encoding and decoding.
Is this an expected behavior? Maybe I am doing something wrong?
Thanks for your help.