code: def _add_secrets(self, api, repo_id):
      if isinstance(self.params, GenericParams):
          for k, v in self.params.env.items():
              api.add_space_secret(repo_id=repo_id, key=k, value=v)
          self.params.env = {}
  
      api.add_space_secret(
          repo_id=repo_id, key="HF_TOKEN", value=self.params.token
      )
      api.add_space_secret(
          repo_id=repo_id, key="AUTOTRAIN_USERNAME", value=self.username
      )
      api.add_space_secret(
          repo_id=repo_id,
          key="PROJECT_NAME",
          value=self.params.project_name,
      )
      api.add_space_secret(
          repo_id=repo_id, key="TASK_ID", value=str(self.task_id)
      )
      api.add_space_secret(
          repo_id=repo_id,
          key="PARAMS",
          value=self.params.model_dump_json(),
      )
  
      if isinstance(self.params, DreamBoothTrainingParams):
          api.add_space_secret(
              repo_id=repo_id,
              key="DATA_PATH",
              value=self.params.image_path,
          )
      else:
          api.add_space_secret(
              repo_id=repo_id,
              key="DATA_PATH",
              value=self.params.data_path,
          )
  
      if not isinstance(self.params, GenericParams):
          api.add_space_secret(
              repo_id=repo_id, key="MODEL", value=self.params.model
          )
          api.add_space_secret(
              repo_id=repo_id,
              key="OUTPUT_MODEL_REPO",
              value=self.params.repo_id,
          )
  
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 4 for calling the SpaceRunner obj's underlying member method code with example usage: obj._add_secrets(api, repo_id) without return types