code: def startup():
      # read job spec
      with open("/cortex/spec/job.json", "r") as f:
          job_spec = json.load(f)
      print(json.dumps(job_spec, indent=2))
  
      # get metadata
      config = job_spec["config"]
      app.job_id = job_spec["job_id"]
      if len(config.get("dest_s3_dir", "")) == 0:
          raise Exception(
              "'dest_s3_dir' field was not provided in job submission"
          )
  
      # s3 info
      app.bucket, app.key = re.match(
          "s3://(.+?)/(.+)", config["dest_s3_dir"]
      ).groups()
      app.key = os.path.join(app.key, app.job_id)
  
      # loading model
      normalize = transforms.Normalize(
          mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
      )
      app.preprocess = transforms.Compose(
          [
              transforms.Resize(256),
              transforms.CenterCrop(224),
              transforms.ToTensor(),
              normalize,
          ]
      )
      app.labels = requests.get(
          "https://storage.googleapis.com/download.tensorflow.org/data/ImageNetLabels.txt"
      ).text.split("\n")[1:]
      app.model = (
          torchvision.models.alexnet(pretrained=True)
          .eval()
          .to(app.device)
      )
  
      app.ready = True
  
file_path: cortex/test/apis/batch/image-classifier-alexnet/app/main.py
imports: import os, json, re
  import requests
  import torch
  import torchvision
  import boto3
  import uuid
  from typing import List
  from PIL import Image
  from io import BytesIO
  from torchvision import transforms
  from fastapi import FastAPI, Request, status
  from fastapi.responses import PlainTextResponse
label_desc: Use image node_id 1 for calling a global function with example usage: startup() without return types