code: def create_session(
      background_tasks: BackgroundTasks,
      uncompress: bool = False,
      expiry: int = 0,
      files: List[UploadFile] = File(...),
  ):
      instance: MONAILabelApp = app_instance()
      sessions: Sessions = instance.sessions()
      if sessions is None:
          logger.error("Session Feature is Not Enabled")
          raise HTTPException(
              status_code=406, detail="Session Feature is Not Enabled"
          )
  
      logger.info(f"Uncompress: {uncompress}; Expiry: {expiry}")
      logger.info(f"Request Files: {files}")
  
      received_dir = tempfile.NamedTemporaryFile().name
      os.makedirs(received_dir, exist_ok=True)
  
      input_image = ""
      total_files = 0
      for f in files:
          basename = (
              get_basename(f.filename)
              if f.filename
              else tempfile.NamedTemporaryFile().name
          )
          input_image = os.path.join(received_dir, basename)
          with open(input_image, "wb") as fb:
              shutil.copyfileobj(f.file, fb)
  
          total_files += 1
          logger.info(f"{total_files} => {f} => {input_image}")
  
      if total_files > 1:
          logger.info(
              f"Input has multiple files; Saving ALL into: {received_dir}"
          )
          input_image = received_dir
  
      session_id, session_info = sessions.add_session(
          input_image, expiry, uncompress
      )
      background_tasks.add_task(remove_file, received_dir)
  
      if total_files == 0:
          raise HTTPException(
              status_code=404, detail="Image(s) Not Found"
          )
  
      logger.info(
          f"Session ID: {session_id}; Info: {session_info.to_str()}"
      )
      return {
          "session_id": session_id,
          "session_info": session_info.to_json(),
      }
  
file_path: MONAILabel/monailabel/endpoints/session.py
imports: import logging
  import os
  import shutil
  import tempfile
  from typing import List
  from fastapi import APIRouter, Depends, File, HTTPException, UploadFile
  from fastapi.background import BackgroundTasks
  from fastapi.responses import FileResponse
  from monailabel.config import RBAC_USER, settings
  from monailabel.endpoints.user.auth import RBAC, User
  from monailabel.interfaces.app import MONAILabelApp
  from monailabel.interfaces.utils.app import app_instance
  from monailabel.utils.others.generic import get_basename, get_mime_type, remove_file
  from monailabel.utils.sessions import Sessions
label_desc: Use image node_id 2 for calling a global function with example usage: create_session(background_tasks, uncompress, expiry, files) and returns: dict