ClassesMappingPreview
Introduction
Classes List Preview
widget displays classes mapping. It can be used to display new names of classes that were edited by the user in the Classes Mapping widget for example.
Function signature
Parameters
classes
List of ObjClass
objects or Supervisely object class collection (ObjClassCollection
).
type: Union[List[ObjClass], ObjClassCollection]
mapping
Dictionary where keys are original class names and values are new names.
type: Dict[str,str]
default None
max_height
Set the maximum height of the widget in pixels. If the content exceeds the maximum height, the scroll bar will appear.
type: str
default "128px"
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Mini App Example
In this example we will create a mini app with ClassesMappingPreview
widget. We will create a ClassesMapping
widget and display changed classes with ClassesMappingPreview
widget.
You can find this example in our Github repository:
supervisely-ecosystem/ui-widgets-demos/media/016_classes_mapping_preview/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Create list of object classes and init ClassesMapping
widget
ClassesMapping
widgetInitialize ClassesMappingPreview
widget and Button
widget for saving and displaying mapping
ClassesMappingPreview
widget and Button
widget for saving and displaying mappingCreate app layout
Prepare a layout for app using Card
widget with the content
parameter and place widgets that we've previously created into the Container
widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widgets from python code
Last updated