code: def _create_endpoint(self):
      hardware = self.spaces_backends[self.backend]
      accelerator = hardware.split("_")[2]
      instance_size = hardware.split("_")[3]
      region = hardware.split("_")[1]
      vendor = hardware.split("_")[0]
      instance_type = hardware.split("_")[4]
      payload = {
          "accountId": self.username,
          "compute": {
              "accelerator": accelerator,
              "instanceSize": instance_size,
              "instanceType": instance_type,
              "scaling": {"maxReplica": 1, "minReplica": 1},
          },
          "model": {
              "framework": "custom",
              "image": {
                  "custom": {
                      "env": {
                          "HF_TOKEN": self.params.token,
                          "AUTOTRAIN_USERNAME": self.username,
                          "PROJECT_NAME": self.params.project_name,
                          "PARAMS": self.params.model_dump_json(),
                          "DATA_PATH": self.params.data_path,
                          "TASK_ID": str(self.task_id),
                          "MODEL": self.params.model,
                          "OUTPUT_MODEL_REPO": self.params.repo_id,
                          "ENDPOINT_ID": f"{self.username}/{self.params.project_name}",
                      },
                      "health_route": "/",
                      "port": 7860,
                      "url": "public.ecr.aws/z4c3o6n6/autotrain-api:latest",
                  }
              },
              "repository": "autotrain-projects/autotrain-advanced",
              "revision": "main",
              "task": "custom",
          },
          "name": self.params.project_name,
          "provider": {"region": region, "vendor": vendor},
          "type": "protected",
      }
      headers = {"Authorization": f"Bearer {self.params.token}"}
      r = requests.post(
          self.ep_api_url, json=payload, headers=headers, timeout=120
      )
      return r.json()["name"]
  
imports: import base64
  import io
  import json
  import os
  import subprocess
  from dataclasses import dataclass
  from typing import Union
  import requests
  from huggingface_hub import HfApi
  from requests.exceptions import HTTPError
  from autotrain import logger
  from autotrain.app_utils import run_training
  from autotrain.trainers.clm.params import LLMTrainingParams
  from autotrain.trainers.dreambooth.params import DreamBoothTrainingParams
  from autotrain.trainers.generic.params import GenericParams
  from autotrain.trainers.image_classification.params import ImageClassificationParams
  from autotrain.trainers.seq2seq.params import Seq2SeqParams
  from autotrain.trainers.tabular.params import TabularParams
  from autotrain.trainers.text_classification.params import TextClassificationParams
label_desc: Use image node_id 5 for calling the SpaceRunner obj's underlying member method code with example usage: obj._create_endpoint() and returns: r