TensorFlow Serving exposes trained models through prediction APIs by separating model weights and computation graphs from the R or Python application. section 6.3.2
library(keras3)
model |>
export_savedmodel("path/to/location", format = "tf_saved_model") #1
reloaded_artifact <- tensorflow::tf$saved_model$load("path/to/location") #2
predictions <- reloaded_artifact$serve(input_data)
Export a Keras model as a TensorFlow SavedModel, reload the serving artifact, and call its serve function with input data. section 6.3.2
Use this deployment pattern when:
- A separate application environment, such as C++ or JavaScript, needs to consume predictions through a REST API. section 6.3.2
- The application has reliable internet access, tolerates roughly 500 ms round trips, and can send non-sensitive input data to a server. section 6.3.2

