"""Demo for TF AI Pipeline."""
from ai_pipeline.models import TFModel


def main():
    config = "examples/tf/config.yaml"
    model = TFModel(config)

    job_id = model.train()
    model.serve(job_id=job_id)


if __name__ == "__main__":
    main()

"""Demo for TF AI Pipeline."""
from ai_pipeline.models import TFModel


def main():
    config = "examples/tf/config.yaml"
    pred_input = [{"age": 25,
                  "workclass": " Private",
                  "education": " 11th",
                  "education_num": 7,
                  "marital_status":" Never-married",
                  "occupation": " Machine-op-inspct",
                  "relationship": " Own-child",
                  "race": " Black",
                  "gender": " Male",
                  "capital_gain": 0,
                  "capital_loss": 0,
                  "hours_per_week": 40,
                  "native_country": " United-States"}]

    model = TFModel(config)
    job_id = model.train()
    version = model.serve(job_id=job_id)
    preds = model.online_predict(pred_input, version=version)

    print("Features: {}".format(pred_input))
    print("Predictions: {}".format(preds))


if __name__ == "__main__":
    main()

Add online prediction example for TF
Add online prediction example for TF

Change-Id: I508aaca04576b3bda500fae3350351ef7b251747

  """Demo for TF AI Pipeline."""
  from ai_pipeline.models import TFModel
  
  
  def main():
      config = "examples/tf/config.yaml"
+     pred_input = [{"age": 25,
+                   "workclass": " Private",
+                   "education": " 11th",
+                   "education_num": 7,
+                   "marital_status":" Never-married",
+                   "occupation": " Machine-op-inspct",
+                   "relationship": " Own-child",
+                   "race": " Black",
+                   "gender": " Male",
+                   "capital_gain": 0,
+                   "capital_loss": 0,
+                   "hours_per_week": 40,
+                   "native_country": " United-States"}]
+ 
      model = TFModel(config)
+     job_id = model.train()
+     version = model.serve(job_id=job_id)
+     preds = model.online_predict(pred_input, version=version)
  
-     job_id = model.train()
-     model.serve(job_id=job_id)
+     print("Features: {}".format(pred_input))
+     print("Predictions: {}".format(preds))
  
  
  if __name__ == "__main__":
      main()
  
Add online prediction example for TF
## Code Before:
"""Demo for TF AI Pipeline."""
from ai_pipeline.models import TFModel


def main():
    config = "examples/tf/config.yaml"
    model = TFModel(config)

    job_id = model.train()
    model.serve(job_id=job_id)


if __name__ == "__main__":
    main()

## Instruction:
Add online prediction example for TF
## Code After:
"""Demo for TF AI Pipeline."""
from ai_pipeline.models import TFModel


def main():
    config = "examples/tf/config.yaml"
    pred_input = [{"age": 25,
                  "workclass": " Private",
                  "education": " 11th",
                  "education_num": 7,
                  "marital_status":" Never-married",
                  "occupation": " Machine-op-inspct",
                  "relationship": " Own-child",
                  "race": " Black",
                  "gender": " Male",
                  "capital_gain": 0,
                  "capital_loss": 0,
                  "hours_per_week": 40,
                  "native_country": " United-States"}]

    model = TFModel(config)
    job_id = model.train()
    version = model.serve(job_id=job_id)
    preds = model.online_predict(pred_input, version=version)

    print("Features: {}".format(pred_input))
    print("Predictions: {}".format(preds))


if __name__ == "__main__":
    main()
