code: def upload(self,  # pylint: disable=too-many-arguments
                 path,
                 name=None,
                 resize=False,
                 rotation=False,
                 callback_url=None,
                 callback_method=None,
                 auto_align=False, ):
          
          if name is None:
              head, tail = ntpath.split(path)
              name = tail or ntpath.basename(head)
  
          url = "http://models.{}/model/".format(self.config.host)
  
          payload = {"name": name,
                     "allowed_transformations": {"resize": resize,
                                                 "rotation": rotation, },
                     "auto-align": auto_align}
          if callback_url and callback_method:
              payload["callback"] = {"url": callback_url, "method": callback_method}
  
          post_resp = requests.post(url, json=payload, cookies={"session": self.session})
          if not post_resp.ok:
              raise errors.ResourceError("payload to model service invalid")
  
          self.name = name
  
          with open(path, "rb") as model_file:
              put_resp = requests.put(post_resp.headers["x-upload-location"],
                                      data=model_file.read(),
                                      headers={"Content-Type": "application/octet-stream"})
              if not put_resp.ok:
                  raise errors.ResourceError("model upload failed")
  
          self.location = post_resp.headers["Location"]
          self._state = self._get_status()
docs: Create a new model resource in the warehouse and uploads the path contents to it