<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Deploying a trained model in ML Engine
After training our CNN model, we can now deploy it to ML Engine and run our predictions on the cloud!
Deploy a version from your trained model
Step1:  Predict with your deployed model
Let's try predicting with our deployed model! We've prepared a input json instance containing an image of a frog for testing.
Step2:  It should output 6 which is the label index for the frog class.
Emojify
Let's run a web application that will use our deployed model to "emojify" arbitrary images!
Install dependencies
Step3:  Run server
<ASSISTANT_TASK:>
Python Code:
%%bash
cd cifar10
MODEL_NAME="cifar10"
VERSION_NAME="v1"
JOB_DIR="gs://dost_deeplearning_cifar10/cifar10_train_1499931245" # Change this to your own
gcloud ml-engine models create $MODEL_NAME
gcloud ml-engine versions create \
  $VERSION_NAME \
  --model $MODEL_NAME \
  --origin $JOB_DIR/model
Explanation: Deploying a trained model in ML Engine
After training our CNN model, we can now deploy it to ML Engine and run our predictions on the cloud!
Deploy a version from your trained model
End of explanation
%%bash
cd cifar10
MODEL_NAME="cifar10"
VERSION_NAME="v1"
gcloud ml-engine predict \
  --model $MODEL_NAME \
  --version $VERSION_NAME \
  --json-instances predict_test.json
Explanation: Predict with your deployed model
Let's try predicting with our deployed model! We've prepared a input json instance containing an image of a frog for testing.
End of explanation
!pip install -r emojify/requirements.txt
Explanation: It should output 6 which is the label index for the frog class.
Emojify
Let's run a web application that will use our deployed model to "emojify" arbitrary images!
Install dependencies
End of explanation
import os
import subprocess
import IPython
from google.datalab.utils import pick_unused_port
port = pick_unused_port()
# Config is reckoned from env vars
env = {
    'PROJECT_ID': 'dost-deeplearning', # Change this to your project id
    'MODEL_NAME': 'cifar10',
    'PORT': str(port),
}
args = ['python', 'emojify/emojify.py']
subprocess.Popen(args, env=env)
    
url = '/_proxy/%d/' % port
html = 'Running emojify! Click <a href="%s" target="_blank">here</a> to access it.' % url
IPython.display.display_html(html, raw=True)
Explanation: Run server
End of explanation
<END_TASK>