code: def predict_image(image, model_name):
      image = Image.fromarray(np.uint8(image)).convert("RGB")
  
      model_path = "./models/" + model_name
  
      if model_name == "DeiT" and model_name not in models:
          models[model_name] = VisionClassifierInference(
              feature_extractor=DeiTFeatureExtractor.from_pretrained(
                  model_path
              ),
              model=DeiTForImageClassification.from_pretrained(
                  model_path
              ),
          )
  
      elif model_name not in models:
          models[model_name] = TorchVisionClassifierInference(
              model_path=model_path
          )
  
      pred = models[model_name].predict_image(
          img=image, return_str=False
      )
  
      for key in pred.keys():
          pred[key] = pred[key] / 100
  
      idx = list(pred.values()).index(max(list(pred.values())))
      label = list(pred.keys())[idx]
  
      return {
          "label": label,
          "probabilities": pred,
      }
  
file_path: HugsVision/docker/API-CPU-ONLY/server/main.py
imports: from io import BytesIO
  from typing import Optional, List
  from fastapi import FastAPI, File, UploadFile
  import numpy
  from PIL import Image
  from transformers import DeiTFeatureExtractor, DeiTForImageClassification
  from hugsvision.inference.VisionClassifierInference import VisionClassifierInference
  from hugsvision.inference.TorchVisionClassifierInference import TorchVisionClassifierInference
label_desc: Use image node_id 1 for calling a global function with example usage: predict_image(image, model_name) and returns: dict