コード例 #1
0
 def get_inputs(self):
     self.input_folder = Folder(
         get_input_names_for_role("input_folder_id")[0])
     output_folder_id = get_output_names_for_role("output_folder_id")[0]
     self.output_folder = Folder(output_folder_id)
     self.output_file_path = get_recipe_config()['output_model_path']
     self.batch_size = int(get_recipe_config()['batch_size'])
     if not get_recipe_config()['show_batch_size']:
         self.batch_size = -1
     self.overwrite_output_model = get_recipe_config(
     )['overwrite_output_model']
     self.model_path = get_recipe_config()['model_path']
     self.model_name = os_splitext(os_split(self.model_path)[1])[0]
     self.float_32 = get_recipe_config()["float_32"]
コード例 #2
0
 def get_inputs(self):
     self.folder = Folder(get_output_names_for_role("folder_id")[0])
     self.output_file_path = get_recipe_config()['output_model_path']
     self.overwrite_output_model = get_recipe_config(
     )['overwrite_output_model']
     self.batch_size = int(get_recipe_config()['batch_size'])
     if not get_recipe_config()['show_batch_size']:
         self.batch_size = -1
     self.model = Model(get_input_names_for_role("saved_model_id")[0])
     self.float_32 = get_recipe_config()["float_32"]
コード例 #3
0
def do(payload, config, plugin_config, inputs):
    if config.get('input_folder_id'):
        folder = Folder(config.get('input_folder_id'))
        paths = folder.list_paths_in_partition()
        choices = []
        for file_name in paths:
            extension = os.path.splitext(file_name)[1]
            if extension == '.h5':
                choices.append({"value": file_name, "label": file_name})
        return {"choices": choices}
    return {}
コード例 #4
0
def do(payload, config, plugin_config, inputs):
    for recipe_input in inputs:
        if recipe_input["role"] == "input_folder_id":
            folder = Folder(recipe_input["fullName"])
    paths = folder.list_paths_in_partition()
    choices = []
    for file_name in paths:
        extension = os.path.splitext(file_name)[1]
        if extension == '.h5':
            choices.append({"value": file_name, "label": file_name})
    return {"choices": choices}
def do(payload, config, plugin_config, inputs):
    for recipe_input in inputs:
        if recipe_input["role"] == "folder":
            folder = Folder(recipe_input["fullName"])
    paths = folder.list_paths_in_partition()
    choices = []
    for fileName in paths:
        if ".json" in fileName:
            jsonFile = folder.read_json(fileName)
            choices.append({"value": fileName,
                            "label": fileName + " (" + jsonFile["name"] + " | " + jsonFile["target"] + ")"})
    return {"choices": choices}
コード例 #6
0
 def __init__(self, project_key, config, plugin_config):
     """
     :param project_key: the project in which the runnable executes
     :param config: the dict of the configuration of the object
     :param plugin_config: contains the plugin settings
     """
     self.project_key = project_key
     self.config = config
     self.plugin_config = plugin_config
     self.folder = Folder(self._get_folder_id(),
                          project_key=self.project_key)
     self.model = Model(self.config.get('saved_model_id'),
                        project_key=self.project_key)
     self.model.list_versions()
     self.output_file_path = self._get_output_file_path()
     self.overwrite_output_model = self.config.get('overwrite_output_model')
     self.batch_size = self._get_batch_size()
     self.float_32 = self.config.get('float_32')
コード例 #7
0
def do(payload, config, plugin_config, inputs):
    folder = None
    for recipe_input in inputs:
        if recipe_input["role"] == "folder":
            folder = Folder(recipe_input["fullName"])
    if folder:
        paths = folder.list_paths_in_partition()
        choices = []
        for file_name in paths:
            if ".json" in file_name:
                choices.append({"value": file_name, "label": file_name})
        return {"choices": choices}
    else:
        return {
            "choices": [{
                "value": None,
                "label": "Invalid : no input folder"
            }]
        }
コード例 #8
0
 def _get_output_folder(self):
     output_folder_id = self.config.get('output_folder_id', None)
     if output_folder_id and output_folder_id != '?':
         return Folder(output_folder_id, project_key=self.project_key)
     else:
         return self.input_folder
コード例 #9
0
 def _get_input_folder(self):
     input_folder_id = self.config.get('input_folder_id', '')
     if not input_folder_id:
         raise ValueError('Input folder has to be selected')
     return Folder(input_folder_id, project_key=self.project_key)