code: def get_prediction(image_bytes):
      try:
          tensor = transform_image(image_bytes=image_bytes)
          outputs = torch.softmax(
              model.forward(tensor).squeeze(), dim=0
          )
          prediction = outputs.detach().cpu().numpy()
          template = "class:{:<15} probability:{:.3f}"
          index_pre = [
              (class_indict[str(index)], float(p))
              for index, p in enumerate(prediction)
          ]
          # sort probability
          index_pre.sort(key=lambda x: x[1], reverse=True)
          text = [template.format(k, v) for k, v in index_pre]
          return_info = {"result": text}
      except Exception as e:
          return_info = {"result": [str(e)]}
      return return_info
  
file_path: deep-learning-for-image-processing/deploying_service/deploying_pytorch/pytorch_flask_service/main.py
imports: import os
  import io
  import json
  import torch
  import torchvision.transforms
  from PIL import Image
  from flask import Flask, jsonify, request, render_template
  from flask_cors import CORS
  from model import MobileNetV2
label_desc: Use image node_id 2 for calling a global function with example usage: get_prediction(image_bytes) and returns: return_info