module documentation

Session class for interacting with the FiftyOne App.

Copyright 2017-2025, Voxel51, Inc.

Class Session Session that maintains a 1-1 shared state with the FiftyOne App.
Function close_app Closes the FiftyOne App, if necessary.
Function launch_app Launches the FiftyOne App.
Function update_state Session method decorator for triggering state update events
Variable logger Undocumented
Function _attach_listeners Undocumented
Function _log_welcome_message_if_allowed Logs a welcome message the first time this function is called on a machine with a new FiftyOne version installed, if allowed.
Function _on_refresh Refreshes session state, including a dataset reload.
Function _pull_group_slice Undocumented
Function _register_session Undocumented
Function _unregister_session Undocumented
Constant _APP_NOTEBOOK_MESSAGE Undocumented
Constant _APP_WEB_MESSAGE Undocumented
Constant _REMOTE_INSTRUCTIONS Undocumented
Constant _WAIT_INSTRUCTIONS Undocumented
Constant _WELCOME_MESSAGE Undocumented
Variable _server_services Undocumented
Variable _session Undocumented
Variable _subscribed_sessions Undocumented
def close_app(): (source)

Closes the FiftyOne App, if necessary.

If no App is currently open, this method has no effect.

def launch_app(dataset: fod.Dataset = None, view: fov.DatasetView = None, sample_id: str = None, group_id: str = None, spaces: Space = None, color_scheme: food.ColorScheme = None, plots: fop.PlotManager = None, port: int = None, address: str = None, remote: bool = False, browser: str = None, height: int = None, auto: bool = True, config: AppConfig = None) -> Session: (source)

Launches the FiftyOne App.

Note that only one App instance can be opened at a time. If this method is called when another App exists, the existing App will be closed.

Parameters
dataset:Nonean optional fiftyone.core.dataset.Dataset or fiftyone.core.view.DatasetView to load
view:Nonean optional fiftyone.core.view.DatasetView to load
sample_id:Nonean optional fiftyone.core.sample.Sample ID to load in the modal
group_id:Nonean optional fiftyone.core.groups.Group ID to load in the modal
spaces:Nonean optional fiftyone.core.odm.workspace.Space instance defining a space configuration to load
color_scheme:Nonean optional fiftyone.core.odm.dataset.ColorScheme defining a custom color scheme to use
plots:Nonean optional fiftyone.core.plots.manager.PlotManager to connect to this session
port:Nonethe port number to serve the App. If None, fiftyone.config.default_app_port is used
address:Nonethe address to serve the App. If None, fiftyone.config.default_app_address is used
remote:Falsewhether this is a remote session, and opening the App should not be attempted
browser:Nonean optional browser to use to open the App. If None, the default browser will be used. Refer to list of supported browsers at https://docs.python.org/3/library/webbrowser.html
height:Nonean optional height, in pixels, at which to render App instances in notebook cells. Only applicable in notebook contexts
auto:Truewhether to automatically show a new App window whenever the state of the session is updated. Only applicable in notebook contexts
config:Nonean optional fiftyone.core.config.AppConfig to control fine-grained default App settings
Returns
Sessiona Session
def update_state(auto_show: bool = False) -> t.Callable: (source)

Session method decorator for triggering state update events

Parameters
auto_show:Falsewhether the method should show a new notebook App cell as well, if auto is True
Returns
t.Callablethe decorated method

Undocumented

def _attach_listeners(session: Session): (source)

Undocumented

def _log_welcome_message_if_allowed(): (source)

Logs a welcome message the first time this function is called on a machine with a new FiftyOne version installed, if allowed.

def _on_refresh(session: Session, state: StateDescription | None): (source)

Refreshes session state, including a dataset reload.

def _pull_group_slice(dataset: fod.Dataset | None, view: fov.DatasetView | None) -> None | str: (source)

Undocumented

def _register_session(session: Session): (source)

Undocumented

def _unregister_session(session: Session): (source)

Undocumented

_APP_NOTEBOOK_MESSAGE: str = (source)

Undocumented

Value
'''
Session launched. Run `session.show()` to open the App in a cell output.
'''
_APP_WEB_MESSAGE: str = (source)

Undocumented

Value
'''
App launched. Point your web browser to http://localhost:{0}
'''
_REMOTE_INSTRUCTIONS: str = (source)

Undocumented

Value
'''
You have launched a remote App on port {0}. To connect to this App from another
machine, issue the following command to configure port forwarding:

ssh -N -L 5151:127.0.0.1:{0} [<username>@]<hostname>

where `[<username>@]<hostname>` refers to your current machine. The App can
...
_WAIT_INSTRUCTIONS: str = (source)

Undocumented

Value
'''
A session appears to have terminated shortly after it was started. If you
intended to start an App instance or a remote session from a script, you should
call `session.wait()` to keep the session (and the script) alive.
'''
_WELCOME_MESSAGE: str = (source)

Undocumented

Value
'''
Welcome to

███████╗██╗███████╗████████╗██╗   ██╗ ██████╗ ███╗   ██╗███████╗
██╔════╝██║██╔════╝╚══██╔══╝╚██╗ ██╔╝██╔═══██╗████╗  ██║██╔════╝
█████╗  ██║█████╗     ██║    ╚████╔╝ ██║   ██║██╔██╗ ██║█████╗
██╔══╝  ██║██╔══╝     ██║     ╚██╔╝  ██║   ██║██║╚██╗██║██╔══╝
...
_server_services: dict = (source)

Undocumented

_session = (source)

Undocumented

_subscribed_sessions = (source)

Undocumented