Algorithmia NameError: имя api_key не определено

Я пытаюсь следовать руководству по развертыванию ML в Algorithmia здесь .

Теперь я застрял здесь:

      algo_utility = algorithmia_utils.AlgorithmiaUtils(api_key, username, algo_name, local_dir)

Хотя я создал ключ API и ввел его в файл algorithmia_utils.py, я получаю сообщение об ошибке:

      NameError: name 'api_key' is not defined

Это код:

      class AlgorithmiaUtils:
    def __init__(self, api_key, username, algo_name, local_dir):
        self.api_key = 'sim3...x1'
        self.username = 'whatever'
        self.algo_name = 'XGBoostDemo'
        self.local_dir = '../algorithmia_repo'

        self.algo_namespace = f"{self.username}/{self.algo_name}"
        self.algo_script_path = "{}/{}/src/{}.py".format(
            self.local_dir, algo_name, algo_name
        )
        self.dependency_file_path = "{}/{}/{}".format(
            self.local_dir, algo_name, "requirements.txt"
        )

        self.algo_client = Algorithmia.client(self.api_key)

0 ответов

Другие вопросы по тегам