Skip to content

Commit

Permalink
CLI: Let function create-native submit label types to the server
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecLad committed Feb 7, 2025
1 parent 1a90c5f commit 567a46f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### Added

- \[CLI\] `function create-native` now sends the function's declared label types
to the server
(<https://github.com/cvat-ai/cvat/pull/9035>)
5 changes: 5 additions & 0 deletions cvat-cli/src/cvat_cli/_internal/commands_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ def execute(
"name": label_spec.name,
}
)

if getattr(label_spec, "type", "any") != "any":
# Add the type conditionally, to stay compatible with older
# CVAT versions when the function doesn't define label types.
remote_function["labels_v2"][-1]["type"] = label_spec.type
else:
raise cvataa.BadFunctionError(
f"Unsupported function spec type: {type(function.spec).__name__}"
Expand Down

0 comments on commit 567a46f

Please sign in to comment.