def main(api_endpoint):
    email = input('Enter Email: ')
    password = getpass.getpass('Enter password for user {}:'.format(email))
    kauth = KiliAuth(email, password, api_endpoint=api_endpoint)
    playground = Playground(kauth)
    project_id = input('Enter project id: ')

    # Check and load new predictions
    STOP_CONDITION = True
    while STOP_CONDITION:
        tools = playground.get_tools(project_id=project_id)
        assert len(tools) == 1
        categories = list(
            json.loads(tools[0]['jsonSettings'])['categories'].keys())

        print('Export assets and labels...')
        assets = playground.export_assets(project_id=project_id)
        print('Done.\n')
        X, y, X_to_be_predicted, ids_X_to_be_predicted = extract_train_for_autoML(
            assets, categories)

        if len(X) > 5:
            print('Online Learning is on its way...')
            predictions = automl_train_and_predict(X, y, X_to_be_predicted)
            # Insert pre-annotations
            for i, prediction in enumerate(tqdm(predictions)):
                json_response = {
                    'categories': [{
                        'name': categories[prediction],
                        'confidence': 100
                    }]
                }
                id = ids_X_to_be_predicted[i]
                playground.create_prediction(asset_id=id,
                                             json_response=json_response)
            print('Done.\n')
        time.sleep(SECONDS_BETWEEN_TRAININGS)
    def get_projects(self, **kwargs):
        return kili.queries.project.get_projects(self.auth.client, **kwargs)

    def get_project(self, **kwargs):
        return kili.queries.project.get_project(self.auth.client, **kwargs)

    # Queries Tool

    def get_tools(self, **kwargs):
        return kili.queries.tool.get_tools(self.auth.client, **kwargs)

    # Queries User

    def get_user(self, **kwargs):
        return kili.queries.user.get_user(self.auth.client, **kwargs)

    # Subscriptions Label

    def label_created_or_updated(self, **kwargs):
        return kili.subscriptions.label.label_created_or_updated(self.auth.client, **kwargs)


if __name__ == '__main__':
    """ Example of usage """
    from kili.authentication import KiliAuth
    from kili.playground import Playground
    kauth = KiliAuth()
    playground = Playground(kauth)
    assets = playground.export_assets(project_id="first-project")
    print(assets)