code: def predict(model_id, image_files, resize, show_image):
      
  
      import google.datalab.ml as ml
  
      images = _util.load_images(image_files, resize=resize)
  
      parts = model_id.split('.')
      if len(parts) != 2:
        raise ValueError('Invalid model name for cloud prediction. Use "model.version".')
      if len(images) == 0:
        raise ValueError('images is empty.')
  
      data = []
      for ii, image in enumerate(images):
        image_encoded = base64.b64encode(image)
        data.append({
          'key': str(ii),
          'image_bytes': {'b64': image_encoded}
        })
  
      predictions = ml.ModelVersions(parts[0]).predict(parts[1], data)
      if len(predictions) == 0:
        raise Exception('Prediction results are empty.')
      # Although prediction results contains a labels list in each instance, they are all the same
      # so taking the first one.
      labels = predictions[0]['labels']
      labels_and_scores = [(x['prediction'], x['scores'][labels.index(x['prediction'])])
                           for x in predictions]
      results = zip(image_files, images, labels_and_scores)
      ret = _util.process_prediction_results(results, show_image)
      return ret
docs: Predict using a deployed (online) model.