What if the model resides on a different machine, we need to decouple the Go and model logic, or if there are multiple actions we may wish to perform, such as training a user-specific model based on user data, and later use this model to generate a prediction? In those cases, our previous solution using command-line arguments will become more complex as we add more arguments to distinguish between actions and return codes. This type of invocation is generally known as Remote Procedure Call (RPC), and solutions such as SOAP or JSON-RPC have been known to the industry for decades[7].
In the following example, we will use a more universal and generic protocol: HTTP. Strictly speaking, HTTP is a data transfer protocol, and one that is often used as the plumbing for RPC protocols. However, with very little effort, we can create our...