InputTag
Introduction
InputTag widget in Supervisely is a user interface element that allows users to add or remove tag labels to items (images, videos, volumes, and point clouds). It uses TagMeta of the current project and allow to use them easily in Supervisely apps. InputTag widget is a valuable tool for improving the organization and efficiency of Supervisely apps.
Function signature
InputTag(
tag_meta,
max_width=300,
widget_id=None,
)
Parameters
tag_meta
TagMeta
TagMeta from which Tags will be selected
max_width
int
Max tag field width
widget_id
str
ID of the widget
tag_meta
Determine TagMeta from which Tags will be selected. Possible Tag types: any_number, any_string, one_of_string, none.
type: TagMeta
max_width
Determine max tag field width.
type: int
default value: 300

widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
value
Get input widget value property.
value(value: tag.value)
Set input widget value property.
get_tag_meta()
Return current TagMeta.
set_tag_meta()
set TagMeta.
activate()
Activate InputTag switch.
deactivate()
Deactivate InputTag switch.
is_active()
Check InputTag switch is active.
is_valid_value(value: tag.value)
Check InputTag current value is valid.
set(tag: Union[Tag, None])
Set given value in InputTag.
get_tag()
Get current Tag from InputTag.
@selection_changed
Decorator function is handled when InputTag selection is changed.
@value_changed
Decorator function is handled when InputTag value is changed.
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/input/003_input_tag/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Initialize Project ID and TagMeta we will use
Project ID and TagMeta we will useInitialize list of InputTag widgets for each TagMeta in project
InputTag widgets for each TagMeta in projectInitialize Button and Text widgets we will use
Button and Text widgets we will useCreate app layout
Prepare a layout for app using Card widget with the content parameter and place widget that we've just created in the Container widget.
Create app using layout
Create an app object with layout parameter.
Handle button clicks
Use the decorators to handle button click and tag values changing. We have button to change tags switch status and text field to show tags values changing.

Last updated
Was this helpful?