SelectAppSession
Introduction
SelectAppSession widget in Supervisely is a dropdown menu that allows users to select an application session from a list of available sessions. SelectAppSession widget is particularly useful when working with multiple application sessions in Supervisely. It can be customized with various parameters, such as the size and label showing.
Function signature
SelectAppSession(
team_id, tags,
show_label=False,
size="mini",
operation="or",
widget_id=None,
)
Parameters
team_id
int
Team ID
tags
List[str]
List of possible tags
show_label
bool
Show label text
size
Literal["large", "small", "mini", None]
Selector size
operation
Literal["or", "and"]
Operation type ("or", "and")
widget_id
str
ID of the widget
team_id
Determine Team from which run sessions will be selected.
type: int
tags
Determines list of possible tags to select run sessions. Tags are set in config.json file of the application in session_tags field.
type: List[str]
show_label
Determine show text App Session on widget or not.
type: bool
default value: false
select_app_session = SelectAppSession(team_id=team_id, tags=["deployed_nn"], show_label=True)
size
Determine selector size (large/small/mini/None).
type: Literal["large", "small", "mini", None]
default value: mini
select_app_session = SelectAppSession(team_id=team_id, tags=["deployed_nn"])
select_app_small = SelectAppSession(team_id=team_id, tags=["deployed_nn"], size="small")
select_app_large = SelectAppSession(team_id=team_id, tags=["deployed_nn"], size="large")
operation
Determine operation type in select. Can be one of "or", "and". Setting the operation parameter to "or" allows users to connect to apps with any of the provided tags, while setting it to "and" allows them to connect to apps that have all the selected tags specified.
type: str
default value: Literal["or", "and"]
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
set_session_id()
Set given session id to widget
get_selected_id()
Return current selected session id
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/selection/008_select_app_session/src/main.py
Import libraries
import os
import supervisely as sly
from dotenv import load_dotenv
from supervisely.app.widgets import Card, Container, SelectAppSessionGet team_id from environment variables
team_id from environment variablesteam_id = sly.env.team_id()Initialize SelectAppSession widget
SelectAppSession widgetselect_app_session = SelectAppSession(team_id=team_id, tags=["deployed_nn"])Create 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.
card = Card(
title="Select App Session",
content=Container(widgets=[select_app_session]),
)
layout = Container(widgets=[card])Create app using layout
Create an app object with layout parameter.
app = sly.Application(layout=layout)
Last updated
Was this helpful?