2708ccddd59bc7be358dc8ae8297dce26f545741,grid/websocket_client.py,WebsocketGridClient,run_remote_inference,#WebsocketGridClient#Any#Any#Any#,382

Before Change



    def run_remote_inference(self, model_id, data, N: int = 1):
        serialized_data = sy.serde.serialize(data)
        result = json.loads(
            self._send_post(
                "models/{}".format(model_id),
                data={
                    "data": serialized_data.decode(self._encoding),
                    "encoding": self._encoding,
                },
                N=N,
            )
        )

        return self._return_bool_result(result, return_key="prediction")

After Change


            "data": serialized_data,
            "encoding": self._encoding,
        }
        self.ws.send(json.dumps(payload))
        response = json.loads(self.ws.recv())
        if response["success"]:
            return torch.tensor(response["prediction"])
        else:
            raise RuntimeError(response["error"])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: OpenMined/Grid
Commit Name: 2708ccddd59bc7be358dc8ae8297dce26f545741
Time: 2019-10-04
Author: ionesiojr@gmail.com
File Name: grid/websocket_client.py
Class Name: WebsocketGridClient
Method Name: run_remote_inference


Project Name: OpenMined/Grid
Commit Name: 2708ccddd59bc7be358dc8ae8297dce26f545741
Time: 2019-10-04
Author: ionesiojr@gmail.com
File Name: grid/websocket_client.py
Class Name: WebsocketGridClient
Method Name: models


Project Name: OpenMined/Grid
Commit Name: 2708ccddd59bc7be358dc8ae8297dce26f545741
Time: 2019-10-04
Author: ionesiojr@gmail.com
File Name: grid/websocket_client.py
Class Name: WebsocketGridClient
Method Name: delete_model