Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 30 additions & 5 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def get_parameters(self, ctx, inputs, required_inputs=True):
description="A name to assign to the generated project",
)
inputs.list(
"member",
"members",
self.build_member(required_inputs=required_inputs),
default=None,
label="Members",
Expand Down Expand Up @@ -592,11 +592,20 @@ def get_parameters(self, ctx, inputs, required_inputs=True):
"or \"NONE\" for no integration)"
)
)
inputs.list(
"required_attrs",
types.String(),
default=None,
label="Required attributes",
description=(
"An optional list of attributes to require on each annotation"
),
)

def parse_parameters(self, ctx, params):
if "member" in params:
params["member"] = [
(m["email"], m["role"]) for m in params["member"]
if "members" in params:
params["members"] = [
(m["email"], m["role"]) for m in params["members"]
]

def build_member(self, required_inputs=True):
Expand Down Expand Up @@ -676,6 +685,14 @@ def execute(self, ctx):


def load_annotations(ctx, inputs):
if "custom_labelbox" not in fo.annotation_config.backends:
fo.annotation_config.backends["custom_labelbox"] = {}

fo.annotation_config.backends["custom_labelbox"].update({
"config_cls": "custom_labelbox.LabelboxBackendConfig",
"url": "https://labelbox.com"
})

anno_keys = ctx.dataset.list_annotation_runs()

if not anno_keys:
Expand Down Expand Up @@ -780,7 +797,7 @@ def execute(self, ctx):

info = ctx.dataset.get_annotation_info(anno_key)

timestamp = info.timestamp.strftime("%Y-%M-%d %H:%M:%S")
timestamp = info.timestamp.strftime("%Y-%m-%d %H:%M:%S")
config = info.config.serialize()
config = {k: v for k, v in config.items() if v is not None}

Expand Down Expand Up @@ -887,6 +904,14 @@ def __call__(self, sample_collection, anno_key, unexpected="prompt", cleanup=Fal
foo.execute_operator(self.uri, ctx, params=params)

def resolve_input(self, ctx):
if "custom_labelbox" not in fo.annotation_config.backends:
fo.annotation_config.backends["custom_labelbox"] = {}

fo.annotation_config.backends["custom_labelbox"].update({
"config_cls": "custom_labelbox.LabelboxBackendConfig",
"url": "https://labelbox.com"
})

inputs = types.Object()

anno_key = get_anno_key(ctx, inputs, show_default=False)
Expand Down
Loading