human
I am working on the file "08_Text_Analysis/06 - Part_4 - Text Classification - Hacker News - DNNClassifier with TF.IDF.ipynb".
The first task is:
5.2 Serving function
Can you write Python code for it?

Give me a the Python code you requested?
assistant
#Here is the Python code you requested.

def generate_serving_input_fn():
    
    def _serving_fn():
    
        receiver_tensor = {
          'title': tf.placeholder(dtype=tf.string, shape=[None])
        }

        _, transformed_features = (
            saved_transform_io.partially_apply_saved_transform(
                os.path.join(Params.TRANSFORM_ARTEFACTS_DIR, transform_fn_io.TRANSFORM_FN_DIR),
            receiver_tensor)
        )
        
        return tf.estimator.export.ServingInputReceiver(
            transformed_features, receiver_tensor)
    
    return _serving_fn