From 92951cff75a863211de43154ce5306280e18ba9d Mon Sep 17 00:00:00 2001 From: GoldenAnpu Date: Thu, 15 Aug 2024 09:37:04 +0200 Subject: [PATCH] Refactor workflow dataset input --- src/main.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main.py b/src/main.py index ba6722c..6e0a241 100644 --- a/src/main.py +++ b/src/main.py @@ -30,11 +30,14 @@ def process(self, context: sly.app.Export.Context): datasets = [api.dataset.get_info_by_id(context.dataset_id)] w.workflow_input(api, datasets[0].id, type="dataset") elif len(selected_datasets) > 0 and not all_datasets: - datasets = [api.dataset.get_info_by_id(dataset_id) for dataset_id in selected_datasets] - w.workflow_input(api, project.id, type="project") + datasets = [api.dataset.get_info_by_id(dataset_id) for dataset_id in selected_datasets] + if len(datasets) == 1: + w.workflow_input(api, datasets[0].id, type="dataset") + else: + w.workflow_input(api, project.id, type="project") else: datasets = api.dataset.get_list(project.id) - w.workflow_input(api, project.id, type="project") + w.workflow_input(api, project.id, type="project") project_meta = sly.ProjectMeta.from_json(api.project.get_meta(project.id)) categories_mapping = f.get_categories_map_from_meta(project_meta)