fiftyone.operators.types¶
FiftyOne operator types.
Classes:
|
Base class for all types. |
|
Represents a void type. |
|
Represents a JSON object. |
|
Represents a property on an |
|
Represents a string. |
|
Represents a boolean. |
|
Represents a number. |
|
Represents a list. |
|
Represents a |
|
Represents an enum. |
|
Represents a one-of type. |
|
Represents a tuple of types. |
|
Represents a map. |
|
Represents a file and related metadata for use with |
|
Represents an object with uploaded file content and its metadata in properties. |
|
Represents a view of a |
|
Represents a view of a |
|
A form view. |
|
A read-only |
|
Represents a choice in a |
|
Represents a set of choices in a |
|
Represents a set of choices in a |
|
Represents a set of choices in a |
|
Represents a notice in a |
|
Represents a header in a |
|
Represents a warning in a |
|
Represents an error in a |
|
Represents a button in a |
|
Displays one of the given |
|
Displays a list of |
|
Displays a tuple of |
|
Displays a code editor. |
|
Displays a color picker. |
|
Displays a tabbed view. |
|
Displays a JSON viewer. |
|
Displays an autocomplete input. |
|
Displays a file input. |
|
Displays a hyperlink. |
|
Allows properties to be hidden from the user. |
|
Displays a loading indicator. |
|
Displays a Plotly chart. |
|
Represents the placement of an operator in the FiftyOne App. |
|
The places available to operators in the FiftyOne App. |
|
Displays a key-value editor. |
|
A column in a |
|
Displays a table. |
|
Displays a key-value mapping. |
|
Displays a progress bar. |
|
Displays an image. |
|
Displays an alert. |
|
Displays a checkbox. |
|
Displays an error. |
|
Displays a header component. |
|
Displays an object component. |
|
Displays a radio component for the given |
|
Displays a toggle switch. |
|
Displays a text input. |
|
Displays a text input. |
|
Displays a lazy text input which only apply input field changes on blur or when user clicks the save button within the field. |
|
Displays a dropdown selector input. |
|
Displays a label-value component. |
|
Displays a primitive value component. |
|
Displays a slider component. |
|
Displays a list of tags component. |
|
Represents a success in a |
|
Represents a button in a |
|
Renders a markdown string as HTML. |
|
Renders a media player for audio and video files. |
|
Displays a file explorer for interacting with files. |
|
Customizes how a prompt is rendered. |
|
Represents the options for a |
|
Displays a view target selector. |
|
Displays properties of an object as a grid of components in horizontal or vertical orientation. |
|
Defines a Dashboard view. |
|
Renders an operator prompt as a left or right side drawer. |
|
Represents a button in a |
|
Displays properties of an object as a horizontal stack of components. |
|
Displays properties of an object as a vertical stack of components. |
|
Displays a group of buttons in a horizontal stack. |
|
Displays a menu of options in a vertical stack. |
|
Displays a floating navigation arrows. |
|
Utility for loading frames and animated panels. |
|
Represents a timeline for playing animations. |
|
Represents a base container for a container types. |
|
Represents an elevated block for a view. |
|
Represents an elevated block for a view. |
-
class
fiftyone.operators.types.
BaseType
¶ Bases:
object
Base class for all types.
Methods:
to_json
()-
to_json
()¶
-
-
class
fiftyone.operators.types.
Void
¶ Bases:
fiftyone.operators.types.BaseType
Represents a void type.
Methods:
to_json
()-
to_json
()¶
-
-
class
fiftyone.operators.types.
Object
(root_view=None)¶ Bases:
fiftyone.operators.types.BaseType
Represents a JSON object.
- Parameters
root_view (None) – the
View
used to display the object
Methods:
add_property
(name, property)Adds a property to the object.
get_property
(name)Gets a property by name.
define_property
(name, type, **kwargs)Defines a property on the object.
str
(name[, allow_empty])Defines a property on the object that is a string.
bool
(name, **kwargs)Defines a property on the object that is a boolean.
int
(name[, min, max])Defines a property on the object that is an integer.
float
(name[, min, max])Defines a property on the object that is a float.
enum
(name, values, **kwargs)Defines a property on the object that is an enum.
list
(name, element_type[, min_items, max_items])Defines a property on the object that is a list.
obj
(name, **kwargs)Defines a property on the object that is an object.
file
(name, **kwargs)Defines a property on the object that is a file.
uploaded_file
(name, **kwargs)Defines a property on the object that is an uploaded file.
view
(name, view, **kwargs)Defines a view-only property.
btn
(name, label[, icon, variant, on_click, …])Defines a button or icon button to display to the user as a
Button
.message
(name, label, **kwargs)Defines a message to display to the user as a
Notice
.grid
(name, **kwargs)Defines a grid view as a
View
.dashboard
(name, **kwargs)Defines a dashboard view as a
View
.plot
(name, **kwargs)Defines an object property displayed as a plot.
h_stack
(name, **kwargs)Defines a horizontal stack object.
v_stack
(name, **kwargs)Defines a vertical stack object.
menu
(name, **kwargs)Defined an
Object
property that is displayed as a menu.btn_group
(name, **kwargs)Defines a button group object.
md
(markdown[, name])Defines a markdown object.
media_player
(name, url, **kwargs)Defines a media player object.
arrow_nav
(name[, forward, backward, position])Defines a floating navigation arrows as a
ArrowNavView
.map
(name, key_type, value_type, **kwargs)Defines a map property on the object.
oneof
(name, types, **kwargs)Defines a one-of property on the object.
tuple
(name, *items, **kwargs)Defines a tuple property on the object.
clone
()Clones the definition of the object.
view_target
(ctx[, name, view_type])Defines a view target property.
to_json
()Converts the object definition to JSON.
-
add_property
(name, property)¶ Adds a property to the object.
- Parameters
name – the name of the property
property – the property to add
- Returns
the
Property
that was added
-
get_property
(name)¶ Gets a property by name.
- Parameters
name – the name of the property
- Returns
the
Property
, or None
-
define_property
(name, type, **kwargs)¶ Defines a property on the object.
-
str
(name, allow_empty=False, **kwargs)¶ Defines a property on the object that is a string.
-
bool
(name, **kwargs)¶ Defines a property on the object that is a boolean.
-
int
(name, min=None, max=None, **kwargs)¶ Defines a property on the object that is an integer.
-
float
(name, min=None, max=None, **kwargs)¶ Defines a property on the object that is a float.
-
enum
(name, values, **kwargs)¶ Defines a property on the object that is an enum.
-
list
(name, element_type, min_items=None, max_items=None, **kwargs)¶ Defines a property on the object that is a list.
-
obj
(name, **kwargs)¶ Defines a property on the object that is an object.
-
file
(name, **kwargs)¶ Defines a property on the object that is a file.
- Parameters
name – the name of the property
view (None) – the
View
of the property
-
uploaded_file
(name, **kwargs)¶ Defines a property on the object that is an uploaded file.
- Parameters
name – the name of the property
view (None) – the
View
of the property
-
view
(name, view, **kwargs)¶ Defines a view-only property.
Examples:
import fiftyone.operators.types as types notice = types.Notice(label="a label", description="a description") inputs = types.Object() inputs.view("notice", notice)
-
btn
(name, label, icon=None, variant=None, on_click=None, prompt=False, params=None, space=None, href=None, icon_position='left', **kwargs)¶ Defines a button or icon button to display to the user as a
Button
.Examples:
import fiftyone.operators.types as types inputs = types.Object() inputs.btn( "greet", label="Say Hi!", icon="waving_hand", variant="round", on_click="print_stdout", params={"msg": "Hi!"}, )
- Parameters
name – the name of the property
label – the label of the button
icon (None) – the name of the icon to display
icon_position ("left") – the position of the icon. Can be
"left"
or"right"
variant (None) – the variant of the button. Can be
"contained"
,"outlined"
,"round"
or"square"
on_click (None) – the name of the operator to execute when the button is clicked
prompt (False) – whether to prompt the user before executing the operator
params (None) – the parameters to pass to the operator
space (None) – An int specifying how much vertical/horizontal space to allocate out of
12
depending on the orientation of the parent containerhref (None) – the URL to navigate to when the button is clicked
-
dashboard
(name, **kwargs)¶ Defines a dashboard view as a
View
.See
DashboardView
for more information.- Parameters
name – the name of the property
- Returns
an
Object
See
DashboardView
for more information.
-
plot
(name, **kwargs)¶ Defines an object property displayed as a plot.
- Parameters
name – the name of the property
config (None) – the chart config
layout (None) – the chart layout
See
PlotlyView
for more information.
-
h_stack
(name, **kwargs)¶ Defines a horizontal stack object.
- Parameters
name – the name of the property
- Returns
a
Object
-
v_stack
(name, **kwargs)¶ Defines a vertical stack object.
- Parameters
name – the name of the property
- Returns
a
Object
Defined an
Object
property that is displayed as a menu.Note
Can be used for an
Button
type with properties whose views are one ofButton
,Dropdown
,DropdownView
, and :class;`Choices`. The variant and color of the items can be set using the variant and color parameters.- Parameters
name – the name of the property
variant (None) – the variant for the items of the menu. Can be
"contained"
,"outlined"
,"round"
or"square"
color (None) – the color for the items of the menu.
overlay (None) – whether to display the menu as an overlay. Can be
"top-left"
,"top-center" –
"top-right" –
"bottom-left" –
"bottom-center"` –
or –
Overlay is useful when you want to display a floating menu on top of ("bottom-right".) –
content (another) –
- Returns
a
Object
-
btn_group
(name, **kwargs)¶ Defines a button group object.
- Parameters
name – the name of the property
- Returns
a
Object
-
md
(markdown, name='markdown', **kwargs)¶ Defines a markdown object.
- Parameters
markdown – the markdown to display
name – the name of the property
-
media_player
(name, url, **kwargs)¶ Defines a media player object.
- Parameters
name – the name of the property
url – the URL of the media to display
on_start (None) – the operator to execute when the media starts
on_play (None) – the operator to execute when the media is played
on_pause (None) – the operator to execute when the media is paused
on_buffer (None) – the operator to execute when the media is buffering
on_buffer_end (None) – the operator to execute when the media stops buffering
on_ended (None) – the operator to execute when the media ends
on_error (None) – the operator to execute when the media errors
on_duration (None) – the operator to execute when the media duration is loaded
on_seek (None) – the operator to execute when the media is seeked
on_progress (None) – the operator to execute when the media progresses
- Returns
a
Object
Defines a floating navigation arrows as a
ArrowNavView
.- Parameters
forward (True) – Whether to display the forward arrow
backward (True) – Whether to display the backward arrow
on_forward (None) – The operator to execute when the forward arrow is clicked
on_backward (None) – The operator to execute when the backward arrow is clicked
position ("center") – The position of the arrows. Can be either
"top"
,center
,"bottom"
,"left"
,middle` (center horizontally), or ``"right"
- Returns
a
Property
-
map
(name, key_type, value_type, **kwargs)¶ Defines a map property on the object.
- Parameters
name – the name of the property
key_type – the type of the keys in the map
value_type – the type of the values in the map
- Returns
a
Map
-
oneof
(name, types, **kwargs)¶ Defines a one-of property on the object.
-
tuple
(name, *items, **kwargs)¶ Defines a tuple property on the object.
- Parameters
name – the name of the property
*items – the types of the items in the tuple
- Returns
a
Tuple
-
clone
()¶ Clones the definition of the object.
- Parameters
name – the name of the property
- Returns
an
Object
-
view_target
(ctx, name='view_target', view_type=None, **kwargs)¶ Defines a view target property.
Examples:
import fiftyone.operators.types as types # # in resolve_input() # inputs = types.Object() vt = inputs.view_target(ctx) # or add the property directly # vt = types.ViewTargetProperty(ctx) # inputs.add_property("view_target", vt) return types.Property(inputs) # # in execute() # target_view = ctx.target_view()
- Parameters
ctx – the
fiftyone.operators.ExecutionContext
name – the name of the property
view_type (RadioGroup) – the view type to use (RadioGroup, Dropdown, etc.)
- Returns
-
to_json
()¶ Converts the object definition to JSON.
- Returns
a JSON dict
-
class
fiftyone.operators.types.
Property
(type, **kwargs)¶ Bases:
fiftyone.operators.types.BaseType
Represents a property on an
fiftyone.operators.Operator
.Properties are used to define the data that an operator can accept as input and return as output.
Properties may also define a
View
that can be used to customize how the property behaves in the FiftyOne App.Examples:
import fiftyone.operators.types as types my_object = types.Object() # Define a string property my_object.str("name", label="Name", description="a description") # Define an enum property with a custom view radio_group = types.RadioGroup() radio_group.add_choice("car", "A brand new car") radio_group.add_choice("truck", "A fancy truck") my_object.enum("type", radio_group.values(), view=radio_group)
- Parameters
type – the type of the property
invalid (False) – whether the property is invalid
default (None) – the default value of the property
required (False) – whether the property is required
error_message ("Invalid") – the error message of the property
view (None) – the
View
of the property
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
String
(allow_empty=False)¶ Bases:
fiftyone.operators.types.BaseType
Represents a string.
- Parameters
allow_empty (False) – allow an empty string value
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
Boolean
¶ Bases:
fiftyone.operators.types.BaseType
Represents a boolean.
Methods:
to_json
()-
to_json
()¶
-
-
class
fiftyone.operators.types.
Number
(min=None, max=None, int=False, float=False)¶ Bases:
fiftyone.operators.types.BaseType
Represents a number.
- Parameters
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
List
(element_type, min_items=None, max_items=None)¶ Bases:
fiftyone.operators.types.BaseType
Represents a list.
- Parameters
element_type – the type of the elements in the list
min_items (None) – the minimum number of items in the list
max_items (None) – the maximum number of items in the list
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
SampleID
¶ Bases:
fiftyone.operators.types.String
Represents a
fiftyone.core.samples.Sample
ID.Methods:
to_json
()-
to_json
()¶
-
-
class
fiftyone.operators.types.
Enum
(values)¶ Bases:
fiftyone.operators.types.BaseType
Represents an enum.
- Parameters
values – the values of the enum
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
OneOf
(types)¶ Bases:
fiftyone.operators.types.BaseType
Represents a one-of type.
Examples:
import fiftyone.operators.types as types my_object = types.Object() my_object.define_property( "my_property", types.OneOf([types.String(), types.Number()], )
- Parameters
types – the possible types
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
Tuple
(*items)¶ Bases:
fiftyone.operators.types.BaseType
Represents a tuple of types.
Examples:
import fiftyone.operators.types as types inputs = types.Object() inputs.define_property( "image", types.Tuple(types.String(), types.Number()) )
- Parameters
*items – the types
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
Map
(key_type, value_type)¶ Bases:
fiftyone.operators.types.BaseType
Represents a map.
Examples:
import fiftyone.operators.types as types inputs = types.Object() inputs.define_property( "image", types.Map(types.String(), types.Number()) )
- Parameters
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
File
(**kwargs)¶ Bases:
fiftyone.operators.types.Object
Represents a file and related metadata for use with
FileExplorerView
.Methods:
add_property
(name, property)Adds a property to the object.
arrow_nav
(name[, forward, backward, position])Defines a floating navigation arrows as a
ArrowNavView
.bool
(name, **kwargs)Defines a property on the object that is a boolean.
btn
(name, label[, icon, variant, on_click, …])Defines a button or icon button to display to the user as a
Button
.btn_group
(name, **kwargs)Defines a button group object.
clone
()Clones the definition of the object.
dashboard
(name, **kwargs)Defines a dashboard view as a
View
.define_property
(name, type, **kwargs)Defines a property on the object.
enum
(name, values, **kwargs)Defines a property on the object that is an enum.
file
(name, **kwargs)Defines a property on the object that is a file.
float
(name[, min, max])Defines a property on the object that is a float.
get_property
(name)Gets a property by name.
grid
(name, **kwargs)Defines a grid view as a
View
.h_stack
(name, **kwargs)Defines a horizontal stack object.
int
(name[, min, max])Defines a property on the object that is an integer.
list
(name, element_type[, min_items, max_items])Defines a property on the object that is a list.
map
(name, key_type, value_type, **kwargs)Defines a map property on the object.
md
(markdown[, name])Defines a markdown object.
media_player
(name, url, **kwargs)Defines a media player object.
menu
(name, **kwargs)Defined an
Object
property that is displayed as a menu.message
(name, label, **kwargs)Defines a message to display to the user as a
Notice
.obj
(name, **kwargs)Defines a property on the object that is an object.
oneof
(name, types, **kwargs)Defines a one-of property on the object.
plot
(name, **kwargs)Defines an object property displayed as a plot.
str
(name[, allow_empty])Defines a property on the object that is a string.
to_json
()Converts the object definition to JSON.
tuple
(name, *items, **kwargs)Defines a tuple property on the object.
uploaded_file
(name, **kwargs)Defines a property on the object that is an uploaded file.
v_stack
(name, **kwargs)Defines a vertical stack object.
view
(name, view, **kwargs)Defines a view-only property.
view_target
(ctx[, name, view_type])Defines a view target property.
-
add_property
(name, property)¶ Adds a property to the object.
- Parameters
name – the name of the property
property – the property to add
- Returns
the
Property
that was added
Defines a floating navigation arrows as a
ArrowNavView
.- Parameters
forward (True) – Whether to display the forward arrow
backward (True) – Whether to display the backward arrow
on_forward (None) – The operator to execute when the forward arrow is clicked
on_backward (None) – The operator to execute when the backward arrow is clicked
position ("center") – The position of the arrows. Can be either
"top"
,center
,"bottom"
,"left"
,middle` (center horizontally), or ``"right"
- Returns
a
Property
-
bool
(name, **kwargs)¶ Defines a property on the object that is a boolean.
-
btn
(name, label, icon=None, variant=None, on_click=None, prompt=False, params=None, space=None, href=None, icon_position='left', **kwargs)¶ Defines a button or icon button to display to the user as a
Button
.Examples:
import fiftyone.operators.types as types inputs = types.Object() inputs.btn( "greet", label="Say Hi!", icon="waving_hand", variant="round", on_click="print_stdout", params={"msg": "Hi!"}, )
- Parameters
name – the name of the property
label – the label of the button
icon (None) – the name of the icon to display
icon_position ("left") – the position of the icon. Can be
"left"
or"right"
variant (None) – the variant of the button. Can be
"contained"
,"outlined"
,"round"
or"square"
on_click (None) – the name of the operator to execute when the button is clicked
prompt (False) – whether to prompt the user before executing the operator
params (None) – the parameters to pass to the operator
space (None) – An int specifying how much vertical/horizontal space to allocate out of
12
depending on the orientation of the parent containerhref (None) – the URL to navigate to when the button is clicked
-
btn_group
(name, **kwargs)¶ Defines a button group object.
- Parameters
name – the name of the property
- Returns
a
Object
-
clone
()¶ Clones the definition of the object.
- Parameters
name – the name of the property
- Returns
an
Object
-
dashboard
(name, **kwargs)¶ Defines a dashboard view as a
View
.See
DashboardView
for more information.- Parameters
name – the name of the property
- Returns
an
Object
See
DashboardView
for more information.
-
define_property
(name, type, **kwargs)¶ Defines a property on the object.
-
enum
(name, values, **kwargs)¶ Defines a property on the object that is an enum.
-
file
(name, **kwargs)¶ Defines a property on the object that is a file.
- Parameters
name – the name of the property
view (None) – the
View
of the property
-
float
(name, min=None, max=None, **kwargs)¶ Defines a property on the object that is a float.
-
get_property
(name)¶ Gets a property by name.
- Parameters
name – the name of the property
- Returns
the
Property
, or None
-
h_stack
(name, **kwargs)¶ Defines a horizontal stack object.
- Parameters
name – the name of the property
- Returns
a
Object
-
int
(name, min=None, max=None, **kwargs)¶ Defines a property on the object that is an integer.
-
list
(name, element_type, min_items=None, max_items=None, **kwargs)¶ Defines a property on the object that is a list.
-
map
(name, key_type, value_type, **kwargs)¶ Defines a map property on the object.
- Parameters
name – the name of the property
key_type – the type of the keys in the map
value_type – the type of the values in the map
- Returns
a
Map
-
md
(markdown, name='markdown', **kwargs)¶ Defines a markdown object.
- Parameters
markdown – the markdown to display
name – the name of the property
-
media_player
(name, url, **kwargs)¶ Defines a media player object.
- Parameters
name – the name of the property
url – the URL of the media to display
on_start (None) – the operator to execute when the media starts
on_play (None) – the operator to execute when the media is played
on_pause (None) – the operator to execute when the media is paused
on_buffer (None) – the operator to execute when the media is buffering
on_buffer_end (None) – the operator to execute when the media stops buffering
on_ended (None) – the operator to execute when the media ends
on_error (None) – the operator to execute when the media errors
on_duration (None) – the operator to execute when the media duration is loaded
on_seek (None) – the operator to execute when the media is seeked
on_progress (None) – the operator to execute when the media progresses
- Returns
a
Object
Defined an
Object
property that is displayed as a menu.Note
Can be used for an
Button
type with properties whose views are one ofButton
,Dropdown
,DropdownView
, and :class;`Choices`. The variant and color of the items can be set using the variant and color parameters.- Parameters
name – the name of the property
variant (None) – the variant for the items of the menu. Can be
"contained"
,"outlined"
,"round"
or"square"
color (None) – the color for the items of the menu.
overlay (None) – whether to display the menu as an overlay. Can be
"top-left"
,"top-center" –
"top-right" –
"bottom-left" –
"bottom-center"` –
or –
Overlay is useful when you want to display a floating menu on top of ("bottom-right".) –
content (another) –
- Returns
a
Object
-
obj
(name, **kwargs)¶ Defines a property on the object that is an object.
-
oneof
(name, types, **kwargs)¶ Defines a one-of property on the object.
-
plot
(name, **kwargs)¶ Defines an object property displayed as a plot.
- Parameters
name – the name of the property
config (None) – the chart config
layout (None) – the chart layout
See
PlotlyView
for more information.
-
str
(name, allow_empty=False, **kwargs)¶ Defines a property on the object that is a string.
-
to_json
()¶ Converts the object definition to JSON.
- Returns
a JSON dict
-
tuple
(name, *items, **kwargs)¶ Defines a tuple property on the object.
- Parameters
name – the name of the property
*items – the types of the items in the tuple
- Returns
a
Tuple
-
uploaded_file
(name, **kwargs)¶ Defines a property on the object that is an uploaded file.
- Parameters
name – the name of the property
view (None) – the
View
of the property
-
v_stack
(name, **kwargs)¶ Defines a vertical stack object.
- Parameters
name – the name of the property
- Returns
a
Object
-
view
(name, view, **kwargs)¶ Defines a view-only property.
Examples:
import fiftyone.operators.types as types notice = types.Notice(label="a label", description="a description") inputs = types.Object() inputs.view("notice", notice)
-
view_target
(ctx, name='view_target', view_type=None, **kwargs)¶ Defines a view target property.
Examples:
import fiftyone.operators.types as types # # in resolve_input() # inputs = types.Object() vt = inputs.view_target(ctx) # or add the property directly # vt = types.ViewTargetProperty(ctx) # inputs.add_property("view_target", vt) return types.Property(inputs) # # in execute() # target_view = ctx.target_view()
- Parameters
ctx – the
fiftyone.operators.ExecutionContext
name – the name of the property
view_type (RadioGroup) – the view type to use (RadioGroup, Dropdown, etc.)
- Returns
-
-
class
fiftyone.operators.types.
UploadedFile
(**kwargs)¶ Bases:
fiftyone.operators.types.Object
Represents an object with uploaded file content and its metadata in properties.
- Properties:
name: the name of the file type: the mime type of the file size: the size of the file in bytes content: the base64 encoded content of the file last_modified: the last modified time of the file in ms since epoch
Methods:
add_property
(name, property)Adds a property to the object.
arrow_nav
(name[, forward, backward, position])Defines a floating navigation arrows as a
ArrowNavView
.bool
(name, **kwargs)Defines a property on the object that is a boolean.
btn
(name, label[, icon, variant, on_click, …])Defines a button or icon button to display to the user as a
Button
.btn_group
(name, **kwargs)Defines a button group object.
clone
()Clones the definition of the object.
dashboard
(name, **kwargs)Defines a dashboard view as a
View
.define_property
(name, type, **kwargs)Defines a property on the object.
enum
(name, values, **kwargs)Defines a property on the object that is an enum.
file
(name, **kwargs)Defines a property on the object that is a file.
float
(name[, min, max])Defines a property on the object that is a float.
get_property
(name)Gets a property by name.
grid
(name, **kwargs)Defines a grid view as a
View
.h_stack
(name, **kwargs)Defines a horizontal stack object.
int
(name[, min, max])Defines a property on the object that is an integer.
list
(name, element_type[, min_items, max_items])Defines a property on the object that is a list.
map
(name, key_type, value_type, **kwargs)Defines a map property on the object.
md
(markdown[, name])Defines a markdown object.
media_player
(name, url, **kwargs)Defines a media player object.
menu
(name, **kwargs)Defined an
Object
property that is displayed as a menu.message
(name, label, **kwargs)Defines a message to display to the user as a
Notice
.obj
(name, **kwargs)Defines a property on the object that is an object.
oneof
(name, types, **kwargs)Defines a one-of property on the object.
plot
(name, **kwargs)Defines an object property displayed as a plot.
str
(name[, allow_empty])Defines a property on the object that is a string.
to_json
()Converts the object definition to JSON.
tuple
(name, *items, **kwargs)Defines a tuple property on the object.
uploaded_file
(name, **kwargs)Defines a property on the object that is an uploaded file.
v_stack
(name, **kwargs)Defines a vertical stack object.
view
(name, view, **kwargs)Defines a view-only property.
view_target
(ctx[, name, view_type])Defines a view target property.
-
add_property
(name, property)¶ Adds a property to the object.
- Parameters
name – the name of the property
property – the property to add
- Returns
the
Property
that was added
Defines a floating navigation arrows as a
ArrowNavView
.- Parameters
forward (True) – Whether to display the forward arrow
backward (True) – Whether to display the backward arrow
on_forward (None) – The operator to execute when the forward arrow is clicked
on_backward (None) – The operator to execute when the backward arrow is clicked
position ("center") – The position of the arrows. Can be either
"top"
,center
,"bottom"
,"left"
,middle` (center horizontally), or ``"right"
- Returns
a
Property
-
bool
(name, **kwargs)¶ Defines a property on the object that is a boolean.
-
btn
(name, label, icon=None, variant=None, on_click=None, prompt=False, params=None, space=None, href=None, icon_position='left', **kwargs)¶ Defines a button or icon button to display to the user as a
Button
.Examples:
import fiftyone.operators.types as types inputs = types.Object() inputs.btn( "greet", label="Say Hi!", icon="waving_hand", variant="round", on_click="print_stdout", params={"msg": "Hi!"}, )
- Parameters
name – the name of the property
label – the label of the button
icon (None) – the name of the icon to display
icon_position ("left") – the position of the icon. Can be
"left"
or"right"
variant (None) – the variant of the button. Can be
"contained"
,"outlined"
,"round"
or"square"
on_click (None) – the name of the operator to execute when the button is clicked
prompt (False) – whether to prompt the user before executing the operator
params (None) – the parameters to pass to the operator
space (None) – An int specifying how much vertical/horizontal space to allocate out of
12
depending on the orientation of the parent containerhref (None) – the URL to navigate to when the button is clicked
-
btn_group
(name, **kwargs)¶ Defines a button group object.
- Parameters
name – the name of the property
- Returns
a
Object
-
clone
()¶ Clones the definition of the object.
- Parameters
name – the name of the property
- Returns
an
Object
-
dashboard
(name, **kwargs)¶ Defines a dashboard view as a
View
.See
DashboardView
for more information.- Parameters
name – the name of the property
- Returns
an
Object
See
DashboardView
for more information.
-
define_property
(name, type, **kwargs)¶ Defines a property on the object.
-
enum
(name, values, **kwargs)¶ Defines a property on the object that is an enum.
-
file
(name, **kwargs)¶ Defines a property on the object that is a file.
- Parameters
name – the name of the property
view (None) – the
View
of the property
-
float
(name, min=None, max=None, **kwargs)¶ Defines a property on the object that is a float.
-
get_property
(name)¶ Gets a property by name.
- Parameters
name – the name of the property
- Returns
the
Property
, or None
-
h_stack
(name, **kwargs)¶ Defines a horizontal stack object.
- Parameters
name – the name of the property
- Returns
a
Object
-
int
(name, min=None, max=None, **kwargs)¶ Defines a property on the object that is an integer.
-
list
(name, element_type, min_items=None, max_items=None, **kwargs)¶ Defines a property on the object that is a list.
-
map
(name, key_type, value_type, **kwargs)¶ Defines a map property on the object.
- Parameters
name – the name of the property
key_type – the type of the keys in the map
value_type – the type of the values in the map
- Returns
a
Map
-
md
(markdown, name='markdown', **kwargs)¶ Defines a markdown object.
- Parameters
markdown – the markdown to display
name – the name of the property
-
media_player
(name, url, **kwargs)¶ Defines a media player object.
- Parameters
name – the name of the property
url – the URL of the media to display
on_start (None) – the operator to execute when the media starts
on_play (None) – the operator to execute when the media is played
on_pause (None) – the operator to execute when the media is paused
on_buffer (None) – the operator to execute when the media is buffering
on_buffer_end (None) – the operator to execute when the media stops buffering
on_ended (None) – the operator to execute when the media ends
on_error (None) – the operator to execute when the media errors
on_duration (None) – the operator to execute when the media duration is loaded
on_seek (None) – the operator to execute when the media is seeked
on_progress (None) – the operator to execute when the media progresses
- Returns
a
Object
Defined an
Object
property that is displayed as a menu.Note
Can be used for an
Button
type with properties whose views are one ofButton
,Dropdown
,DropdownView
, and :class;`Choices`. The variant and color of the items can be set using the variant and color parameters.- Parameters
name – the name of the property
variant (None) – the variant for the items of the menu. Can be
"contained"
,"outlined"
,"round"
or"square"
color (None) – the color for the items of the menu.
overlay (None) – whether to display the menu as an overlay. Can be
"top-left"
,"top-center" –
"top-right" –
"bottom-left" –
"bottom-center"` –
or –
Overlay is useful when you want to display a floating menu on top of ("bottom-right".) –
content (another) –
- Returns
a
Object
-
obj
(name, **kwargs)¶ Defines a property on the object that is an object.
-
oneof
(name, types, **kwargs)¶ Defines a one-of property on the object.
-
plot
(name, **kwargs)¶ Defines an object property displayed as a plot.
- Parameters
name – the name of the property
config (None) – the chart config
layout (None) – the chart layout
See
PlotlyView
for more information.
-
str
(name, allow_empty=False, **kwargs)¶ Defines a property on the object that is a string.
-
to_json
()¶ Converts the object definition to JSON.
- Returns
a JSON dict
-
tuple
(name, *items, **kwargs)¶ Defines a tuple property on the object.
- Parameters
name – the name of the property
*items – the types of the items in the tuple
- Returns
a
Tuple
-
uploaded_file
(name, **kwargs)¶ Defines a property on the object that is an uploaded file.
- Parameters
name – the name of the property
view (None) – the
View
of the property
-
v_stack
(name, **kwargs)¶ Defines a vertical stack object.
- Parameters
name – the name of the property
- Returns
a
Object
-
view
(name, view, **kwargs)¶ Defines a view-only property.
Examples:
import fiftyone.operators.types as types notice = types.Notice(label="a label", description="a description") inputs = types.Object() inputs.view("notice", notice)
-
view_target
(ctx, name='view_target', view_type=None, **kwargs)¶ Defines a view target property.
Examples:
import fiftyone.operators.types as types # # in resolve_input() # inputs = types.Object() vt = inputs.view_target(ctx) # or add the property directly # vt = types.ViewTargetProperty(ctx) # inputs.add_property("view_target", vt) return types.Property(inputs) # # in execute() # target_view = ctx.target_view()
- Parameters
ctx – the
fiftyone.operators.ExecutionContext
name – the name of the property
view_type (RadioGroup) – the view type to use (RadioGroup, Dropdown, etc.)
- Returns
-
class
fiftyone.operators.types.
View
(container=None, **kwargs)¶ Bases:
object
Represents a view of a
Property
.Views are used to define how properties are displayed in the FiftyOne App.
- Parameters
label (None) – a label for the view
description (None) – a description for the view
caption (None) – a caption for the view
space (12) – An int specifying how much vertical/horizontal space to allocate out of
12
depending on the orientation of the parent containerplaceholder (None) – string to display placeholder text
read_only (False) – whether the view is read-only
component (None) – specifying custom component to use as the view
componentsProps (None) – dict for providing props to components rendered by a view
container (None) – the container (instance of
BaseType
) of the view
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
InferredView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a view of a
Property
that is inferred from the data.Note
You can only use inferred views for input properties.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
Form
(live=False, submit_button_label='Execute', cancel_button_label='Close', **kwargs)¶ Bases:
fiftyone.operators.types.View
A form view.
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
-
class
fiftyone.operators.types.
ReadOnlyView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
A read-only
View
.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
Choice
(value, include=True, **kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a choice in a
Choices
view.- Parameters
Methods:
clone
()Clones the
Choice
.to_json
()-
to_json
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
Choices
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a set of choices in a
View
.Use this view to define a set of choices for a
Property
that can be selected by the user and require labels and optional descriptions.Examples:
import fiftyone.operators.types as types choices = types.Choices() choices.add_choice("cat", label="Cat", description="A cat") choices.add_choice("dog", label="Dog", description="A dog") inputs = types.Object() inputs.enum("animal", choices.values(), view=choices)
- Parameters
choices (None) – a list of
Choice
instances
Attributes:
Methods:
values
()Returns the choice values for this instance.
add_choice
(value, **kwargs)Adds a choice value to this instance.
append
(choice)Appends a
Choice
to the list of choices.clone
()to_json
()-
property
choices
¶
-
values
()¶ Returns the choice values for this instance.
- Returns
a list of values
-
add_choice
(value, **kwargs)¶ Adds a choice value to this instance.
- Parameters
value – a choice value
- Returns
the
Choice
that was added
-
clone
()¶
-
to_json
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
RadioGroup
(**kwargs)¶ Bases:
fiftyone.operators.types.Choices
Represents a set of choices in a
View
that are displayed as a radio group.Examples:
import fiftyone.operators.types as types choices = types.RadioGroup() choices.add_choice("cat", label="Cat", description="A cat") choices.add_choice("dog", label="Dog", description="A dog") inputs = types.Object() inputs.enum("animal", choices.values(), view=choices)
- Parameters
orientation ("horizontal") – the orientation of the radio group Can be
"horizontal"
or"vertical"
label (None) – a label for the radio group
description (None) – a description for the radio group
caption (None) – a caption for the radio group
Methods:
to_json
()add_choice
(value, **kwargs)Adds a choice value to this instance.
append
(choice)Appends a
Choice
to the list of choices.clone
()values
()Returns the choice values for this instance.
Attributes:
-
to_json
()¶
-
add_choice
(value, **kwargs)¶ Adds a choice value to this instance.
- Parameters
value – a choice value
- Returns
the
Choice
that was added
-
property
choices
¶
-
clone
()¶
-
kwargs_to_json
()¶
-
values
()¶ Returns the choice values for this instance.
- Returns
a list of values
-
class
fiftyone.operators.types.
Dropdown
(**kwargs)¶ Bases:
fiftyone.operators.types.Choices
Represents a set of choices in a
View
that are displayed as a dropdown.Examples:
import fiftyone.operators.types as types choices = types.Dropdown() choices.add_choice("cat", label="Cat", description="A cat") choices.add_choice("dog", label="Dog", description="A dog") inputs = types.Object() inputs.enum("animal", choices.values(), view=choices)
- Parameters
label (None) – a label for the dropdown
description (None) – a description for the dropdown
caption (None) – a caption for the dropdown
Methods:
add_choice
(value, **kwargs)Adds a choice value to this instance.
append
(choice)Appends a
Choice
to the list of choices.clone
()to_json
()values
()Returns the choice values for this instance.
Attributes:
-
add_choice
(value, **kwargs)¶ Adds a choice value to this instance.
- Parameters
value – a choice value
- Returns
the
Choice
that was added
-
property
choices
¶
-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
values
()¶ Returns the choice values for this instance.
- Returns
a list of values
-
class
fiftyone.operators.types.
Notice
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a notice in a
View
.You can use this view to display notices to the user.
Examples:
import fiftyone.operators.types as types inputs = types.Object() inputs.notice("This is a notice")
- Parameters
label (None) – a label for the notice
description (None) – a description for the notice
caption (None) – a caption for the notice
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
Header
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a header in a
View
.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
Warning
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a warning in a
View
.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
Error
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents an error in a
View
.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
Button
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a button in a
View
.Examples:
import fiftyone.operators.types as types button = types.Button( label="Click me", operator="print_stdout", params={"msg": "Hello World"}, ) inputs = types.Object() inputs.view("btn", button)
- Parameters
label (None) – a label for the button
description (None) – a description for the button
caption (None) – a caption for the button
operator (None) – the name of the operator to execute when the button is clicked
params (None) – the parameters to pass to the operator
href (None) – the URL to navigate to when the button is clicked
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
OneOfView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays one of the given
View
instances.Examples:
import fiftyone.operators.types as types choices = types.RadioGroup() choices.add_choice("cat", label="Cat", description="A cat") choices.add_choice("dog", label="Dog", description="A dog") view = types.OneOfView( oneof=[types.Enum(choices.values()), types.String()] ) inputs = types.Object() inputs.define_property(types.OneOfView(oneof=[choices]), view=view)
- Parameters
oneof (None) – a list of
View
instances
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
ListView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a list of
View
instances.Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
-
class
fiftyone.operators.types.
TupleView
(*itemsView, **options)¶ Bases:
fiftyone.operators.types.View
Displays a tuple of
View
instances.Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
-
class
fiftyone.operators.types.
CodeView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a code editor.
Examples:
import fiftyone.operators.types as types inputs = types.Object() inputs.str("src", types.CodeView(language="python"))
- Parameters
language (None) – the language to use for syntax highlighting
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
ColorView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a color picker.
- Parameters
compact (None) – whether to display the color picker in compact mode
variant (None) – the variant of the color picker. See https://casesandberg.github.io/react-color
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
TabsView
(**kwargs)¶ Bases:
fiftyone.operators.types.Choices
Displays a tabbed view.
- Parameters
variant (None) – the variant of the tabs. See https://material-ui.com/components/tabs
Methods:
to_json
()add_choice
(value, **kwargs)Adds a choice value to this instance.
append
(choice)Appends a
Choice
to the list of choices.clone
()values
()Returns the choice values for this instance.
Attributes:
-
to_json
()¶
-
add_choice
(value, **kwargs)¶ Adds a choice value to this instance.
- Parameters
value – a choice value
- Returns
the
Choice
that was added
-
property
choices
¶
-
clone
()¶
-
kwargs_to_json
()¶
-
values
()¶ Returns the choice values for this instance.
- Returns
a list of values
-
class
fiftyone.operators.types.
JSONView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a JSON viewer.
Examples:
# Show an object/dictionary in a JSON viewer outputs.obj("my_property", label="My Object", view=types.JSONView())
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
AutocompleteView
(**kwargs)¶ Bases:
fiftyone.operators.types.Choices
Displays an autocomplete input.
Note
This view can be used in place of
Choices
.- Parameters
choices (None) – a list of
Choice
instancesread_only (False) – whether the view is read-only
Methods:
add_choice
(value, **kwargs)Adds a choice value to this instance.
append
(choice)Appends a
Choice
to the list of choices.clone
()to_json
()values
()Returns the choice values for this instance.
Attributes:
-
add_choice
(value, **kwargs)¶ Adds a choice value to this instance.
- Parameters
value – a choice value
- Returns
the
Choice
that was added
-
property
choices
¶
-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
values
()¶ Returns the choice values for this instance.
- Returns
a list of values
-
class
fiftyone.operators.types.
FileView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a file input.
Note
This view can be used on
String
orUploadedFile
properties. If used on aString
property, the value will be the base64-encoded contents. If used on aUploadedFile
, the value will be aUploadedFile
object.- Parameters
max_size (None) – a maximum allowed size of the file, in bytes
max_size_error_message (None) – an error message to display if the file exceeds the max size
types (None) – a string containing the comma-separated file types to accept
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
LinkView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a hyperlink.
- Parameters
href (None) – the URL to link to. Defaults to the property
value.href
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
HiddenView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Allows properties to be hidden from the user.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
LoadingView
(**kwargs)¶ Bases:
fiftyone.operators.types.ReadOnlyView
Displays a loading indicator.
- Parameters
label ("Loading") – a label for the loading indicator
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
PlotlyView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a Plotly chart.
Note
See https://github.com/plotly/react-plotly.js/#basic-props for documentation.
All event handlers have the following default params:
id
: the corresponding data.ids[idx]path
: the path of the propertyrelative_path
: the relative path of the propertyschema
: the schema of the propertyview
: the value of the PlotlyViewevent
: the event name (eg. onClick, onSelected, onDoubleClick)value
: the value of the clicked point (only pie chart-like plots)label
: the label of the clicked point (only pie chart-like plots)shift_pressed
: whether the shift key was pressed
Examples:
def render(self, ctx): panel.plot("my_plot", on_click=self.on_click, on_selected=self.on_selected) def print_params(self, ctx, params): for key, value in params.items(): ctx.print(f"{key}: {value}") def on_click(self, ctx): # available params self.print_prams(ctx, { "id": "id", # the corresponding data.ids[idx] "idx": 1, # the index of the clicked point "label": "label", # label (eg. on pie charts) "shift_pressed": false, # whether the shift key was pressed "trace": "my_trace", # data[trace_idx].name "trace_idx": 0, "value": "my_value", # data[trace_idx].values[idx] (eg. on a pie chart) "x": 2, # data[trace_idx].x[idx] (the x value on most plot types) "y": 3, # data[trace_idx].y[idx] (the y value on most plot types) "z": 4, # data[trace_idx].z[idx] (the z value on 3d plots eg. heatmap) }) def on_selected(self, ctx): prin(ctx.params['data']) # [ # { # "trace": "trace 0", # data[trace_idx].name # "trace_idx": 0, # the index of the trace # "idx": 1, # the index of the selected point # "id": "one", # the corresponding data.ids[idx] # "x": 2, # the x value of the selected point # "y": 15, # the y value of the selected point # "z": 22 # the z value of the selected point # } # ]
- Parameters
data (None) – the chart data
config (None) – the chart config
layout (None) – the chart layout
on_click (None) – event handler for click events
on_selected (None) – event handler for selected events
on_double_click (None) – event handler for double click events
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
Placement
(place, view=None)¶ Bases:
object
Represents the placement of an operator in the FiftyOne App.
Methods:
to_json
()-
to_json
()¶
-
-
class
fiftyone.operators.types.
Places
(value)¶ Bases:
enum.Enum
The places available to operators in the FiftyOne App.
Attributes:
Methods:
to_json
()-
SAMPLES_GRID_ACTIONS
= 'samples-grid-actions'¶
-
SAMPLES_GRID_SECONDARY_ACTIONS
= 'samples-grid-secondary-actions'¶
-
SAMPLES_VIEWER_ACTIONS
= 'samples-viewer-actions'¶
-
EMBEDDINGS_ACTIONS
= 'embeddings-actions'¶
-
HISTOGRAM_ACTIONS
= 'histograms-actions'¶
-
MAP_ACTIONS
= 'map-actions'¶
-
MAP_SECONDARY_ACTIONS
= 'map-secondary-actions'¶
-
DISPLAY_OPTIONS
= 'display-options'¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
KeyValueView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a key-value editor.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
Column
(key, **kwargs)¶ Bases:
fiftyone.operators.types.View
A column in a
TableView
.- Parameters
key – the name of the property to use for data
Methods:
clone
()to_json
()-
clone
()¶
-
to_json
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
TableView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a table.
- Parameters
columns (None) – a list of
Column
objects to display
Methods:
keys
()add_column
(key, **kwargs)clone
()to_json
()-
keys
()¶
-
add_column
(key, **kwargs)¶
-
clone
()¶
-
to_json
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
MapView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a key-value mapping.
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
-
class
fiftyone.operators.types.
ProgressView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a progress bar.
Examples:
import fiftyone.operators as foo import fiftyone.operators.types as types class ExampleProgress(foo.Operator): @property def config(self): return foo.OperatorConfig( name="example_progress", label="Examples: Progress", execute_as_generator=True, ) async def execute(self, ctx): outputs = types.Object() schema = types.Property(outputs) n = 100 for i in range(n): label = f"Loading {i} of {n}" progress_view = types.ProgressView(label=label) loading_schema = types.Object() loading_schema.int("percent_complete", view=progress_view) show_output_params = { "outputs": types.Property(loading_schema).to_json(), "results": {"percent_complete": i / n} } yield ctx.trigger("show_output", show_output_params) # Simulate computation await asyncio.sleep(0.5)
- Parameters
label (None) – the label to display under the progress bar
variant (None) – bar variant. Supported values are
"linear"
and"circular"
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
ImageView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays an image.
Examples:
def execute(): return {"image": "https://voxel51.com/your/image.png"} def resolve_output(self, ctx): outputs = types.Object() outputs.define_property( "image", types.String(), label="Image", view=types.ImageView(), ) return types.Property(outputs)
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
AlertView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays an alert.
- Parameters
severity (None) – the severity of the alert displayed, one of
(info", "success", "warning", "error")
componentsProps (None) –
an optional dict with the following keys:
'label'
(None): props to pass to the label subcomponents'description'
(None): props to pass to the description subcomponents'caption'
(None): props to pass to the caption subcomponents
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
CheckboxView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a checkbox.
Examples:
inputs.bool( "my_property_name", default=True, label="My Checkbox", description="A checkbox description.", view=types.CheckboxView(), )
Note
Must be used with
Boolean
properties.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
ErrorView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays an error.
- Parameters
detailed (False) – whether to display a detailed error message
popout (None) – if provided, displays a popout button with the given dictionary of props
left (False) – whether to display on the left side of the popout button
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
HeaderView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a header component.
Headers can have a
title
,description
, andcaption
, each of which are displayed in a separate line.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
ObjectView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays an object component.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
RadioView
(**kwargs)¶ Bases:
fiftyone.operators.types.RadioGroup
Displays a radio component for the given
RadioGroup
instance.Methods:
add_choice
(value, **kwargs)Adds a choice value to this instance.
append
(choice)Appends a
Choice
to the list of choices.clone
()to_json
()values
()Returns the choice values for this instance.
Attributes:
-
add_choice
(value, **kwargs)¶ Adds a choice value to this instance.
- Parameters
value – a choice value
- Returns
the
Choice
that was added
-
property
choices
¶
-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
values
()¶ Returns the choice values for this instance.
- Returns
a list of values
-
-
class
fiftyone.operators.types.
SwitchView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a toggle switch.
Note
Must be used with
Boolean
properties.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
TextFieldView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a text input.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
FieldView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a text input.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
LazyFieldView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a lazy text input which only apply input field changes on blur or when user clicks the save button within the field.
- Parameters
save_on_blur (True) – when set to False, changes in input field will not be automatically applied when user moves mouse out of the changed field. To apply changes, user must click the save button.
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
DropdownView
(**kwargs)¶ Bases:
fiftyone.operators.types.Dropdown
Displays a dropdown selector input.
Methods:
add_choice
(value, **kwargs)Adds a choice value to this instance.
append
(choice)Appends a
Choice
to the list of choices.clone
()to_json
()values
()Returns the choice values for this instance.
Attributes:
-
add_choice
(value, **kwargs)¶ Adds a choice value to this instance.
- Parameters
value – a choice value
- Returns
the
Choice
that was added
-
property
choices
¶
-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
values
()¶ Returns the choice values for this instance.
- Returns
a list of values
-
-
class
fiftyone.operators.types.
LabelValueView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a label-value component. Used for displaying a label and a corresponding value.
Note
Must be used with
String
,Number
, orBoolean
properties, or lists of such properties. Also this view is not supported for input properties.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
PrimitiveView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a primitive value component.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
SliderView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a slider component.
Note
This view must be used with
Number
properties.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
TagsView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a list of tags component.
Note
Must be used with
List
properties whose items areString
,Number:, or :class:`Boolean
instancesMethods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
Success
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a success in a
View
.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
ButtonView
(**kwargs)¶ Bases:
fiftyone.operators.types.Button
Represents a button in a
Button
.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
MarkdownView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Renders a markdown string as HTML.
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
MediaPlayerView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Renders a media player for audio and video files.
- Parameters
name – the name of the property
url – the URL of the media to display
on_start (None) – the operator to execute when the media starts
on_play (None) – the operator to execute when the media is played
on_pause (None) – the operator to execute when the media is paused
on_buffer (None) – the operator to execute when the media is buffering
on_buffer_end (None) – the operator to execute when the media stops buffering
on_ended (None) – the operator to execute when the media ends
on_error (None) – the operator to execute when the media errors
on_duration (None) – the operator to execute when the media duration is loaded
on_seek (None) – the operator to execute when the media is seeked
on_progress (None) – the operator to execute when the media progresses
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
FileExplorerView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays a file explorer for interacting with files.
Examples:
import os import fiftyone.operators.types as types inputs = types.Object() # Create an explorer that allows the user to choose a directory file_explorer = types.FileExplorerView( choose_dir=True, button_label="Choose a directory...", choose_button_label="Accept" ) # Define a types.File property file_prop = inputs.file( "directory", required=True, label="Directory", description="Choose a directory", view=file_explorer, ) directory = ctx.params.get("directory", {}).get("absolute_path", None)
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
PromptView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Customizes how a prompt is rendered.
Examples:
import fiftyone.operators.types as types # in resolve_input prompt = types.PromptView( label="This is the title", submit_button_label="Click me", cancel_button_label="Abort" ) inputs = types.Object() inputs.md("Hello world!") return types.Property(inputs, view=prompt)
- Parameters
label (None) – the title for the prompt
submit_button_label (None) – the label for the submit button
cancel_button_label (None) – the label for the cancel button
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
ViewTargetOptions
(choices_view, **kwargs)¶ Bases:
object
Represents the options for a
ViewTargetProperty
.Methods:
values
()-
values
()¶
-
-
class
fiftyone.operators.types.
ViewTargetProperty
(ctx, view_type=<class 'fiftyone.operators.types.RadioGroup'>, **kwargs)¶ Bases:
fiftyone.operators.types.Property
Displays a view target selector.
Examples:
import fiftyone.operators.types as types # in resolve_input inputs = types.Object() vt = inputs.view_target(ctx) # or add the property directly # vt = types.ViewTargetProperty(ctx) # inputs.add_property("view_target", vt) return types.Property(inputs) # in execute() target_view = ctx.target_view()
-
options
¶ a
ViewTargetOptions
instance
- Parameters
ctx – the
fiftyone.operators.ExecutionContext
view_type (RadioGroup) – the type of view to use (RadioGroup or Dropdown)
Attributes:
Methods:
to_json
()-
property
options
¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
GridView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Displays properties of an object as a grid of components in horizontal or vertical orientation.
Note
Must be used with
Object
properties.- Parameters
orientation ("2d") – the orientation of the stack. Can be either
"2d"
,"horizontal"
or"vertical"
gap (1) – the gap between the components
align_x ("left") – the alignment of the components. Can be either
"left"
,"center"
, or"right"
align_y ("top") – the alignment of the components. Can be either
"top"
,"center"
, or"bottom"
variant (None) – the variant of the grid. Can be either
"paper"
or"outline"
elevation (None) – the elevation of the grid. Only applicable when
variant="paper"
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
DashboardView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Defines a Dashboard view.
- Parameters
layout (None) – the layout of the dashboard.
on_save_layout (None) – event triggered when the layout changes
on_add_item (None) – event triggered when an item is added
on_remove_item (None) – event triggered when an item is closed
on_edit_item (None) – event triggered when an item is edited
allow_addition (True) – whether to allow adding items
allow_deletion (True) – whether to allow deleting items
allow_edit (True) – whether to allow editing items
cta_title (None) – the title of the call to action
cta_body (None) – the body of the call to action
cta_button_label (None) – the label of the call to action button
rows (None) – the number of rows in the dashboard
cols (None) – the number of columns in the dashboard
items (None) – the custom layout of the dashboard
auto_layout (True) – whether to automatically layout the dashboard
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
class
fiftyone.operators.types.
DrawerView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Renders an operator prompt as a left or right side drawer.
Examples:
import fiftyone.operators.types as types # in resolve_input inputs = types.Object() inputs.str("message", label="Message") prompt = types.DrawerView(placement="left") return types.Property(inputs, view=prompt)
- Parameters
placement (None) –
the placement of the drawer. Can be one of the following
'left'
: display to the left of the main or expanded view'right'
: display to the right of the main or expanded view
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
IconButtonView
(**kwargs)¶ Bases:
fiftyone.operators.types.Button
Represents a button in a
View
.Examples:
import fiftyone.operators.types as types iconButtonView = types.IconButtonView( icon="waving_hand", operator="print_stdout", params={"msg": "Hi!"}, ) inputs = types.Object() inputs.view("icon_btn", iconButtonView)
- Parameters
icon (None) – a icon for the button. See https://marella.me/material-icons/demo/
variant (None) – the optional variant of the icon button. Can be
"round"
,"square"
,"outlined"
, or"contained"
.label (None) – a label for the button
description (None) – a description for the button
caption (None) – a caption for the button
operator (None) – the name of the operator to execute when the button is clicked
params (None) – the parameters to pass to the operator
href (None) – the URL to navigate to when the button is clicked
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
HStackView
(orientation='horizontal', **kwargs)¶ Bases:
fiftyone.operators.types.GridView
Displays properties of an object as a horizontal stack of components.
Note
Must be used with
Object
properties.Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
-
class
fiftyone.operators.types.
VStackView
(orientation='vertical', **kwargs)¶ Bases:
fiftyone.operators.types.GridView
Displays properties of an object as a vertical stack of components.
Note
Must be used with
Object
properties.Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
-
class
fiftyone.operators.types.
ButtonGroupView
(orientation='horizontal', **kwargs)¶ Bases:
fiftyone.operators.types.GridView
Displays a group of buttons in a horizontal stack.
Note
Must be used with
Button
properties.Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
-
-
class
fiftyone.operators.types.
MenuView
(orientation='horizontal', **kwargs)¶ Bases:
fiftyone.operators.types.GridView
Displays a menu of options in a vertical stack.
Note
Can be used for an
Button
type with properties whose views are one ofButton
,Dropdown
,DropdownView
, and :class;`Choices`. The variant and color of the items can be set using the variant and color parameters.- Parameters
name – the name of the property
variant (None) – the variant for the items of the menu. Can be
"contained"
,"outlined"
,"round"
or"square"
color (None) – the color for the items of the menu.
overlay (None) – whether to display the menu as an overlay. Can be
"top-left"
,"top-center" –
"top-right" –
"bottom-left" –
"bottom-center"` –
or –
Overlay is useful when you want to display a floating menu on top of ("bottom-right".) –
content (another) –
- Returns
a
Object
Methods:
to_json
()clone
()-
to_json
()¶
-
clone
()¶
-
kwargs_to_json
()¶
Bases:
fiftyone.operators.types.View
Displays a floating navigation arrows.
- Parameters
forward (True) – Whether to display the forward arrow
backward (True) – Whether to display the backward arrow
on_forward (None) – The operator to execute when the forward arrow is clicked
on_backward (None) – The operator to execute when the backward arrow is clicked
position ("center") – The position of the arrows. Can be either
"top"
,center
,"bottom"
,"left"
,middle` (center horizontally), or ``"right"
Methods:
to_json
()clone
()
-
class
fiftyone.operators.types.
FrameLoaderView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Utility for loading frames and animated panels.
- Parameters
timeline_id (None) – the ID of the timeline to load
on_load (None) – the operator to execute when the frame is loaded
on_error (None) – the operator to execute when the frame fails to load
on_load_range (None) – the operator to execute when the frame is loading
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
TimelineView
(**kwargs)¶ Bases:
fiftyone.operators.types.View
Represents a timeline for playing animations.
- Parameters
timeline_name (None) – the name of the timeline
total_frames (None) – the total number of frames in the timeline
loop (False) – whether to loop the timeline
Methods:
clone
()to_json
()-
clone
()¶
-
kwargs_to_json
()¶
-
to_json
()¶
-
class
fiftyone.operators.types.
Container
(**kwargs)¶ Bases:
fiftyone.operators.types.BaseType
Represents a base container for a container types.
Methods:
to_json
()-
to_json
()¶
-
-
class
fiftyone.operators.types.
PaperContainer
(elevation=1, rounded=True, **kwargs)¶ Bases:
fiftyone.operators.types.Container
Represents an elevated block for a view.
- Parameters
elevation (1) – the elevation of the container. Can be a value between 0 and 24
rounded (True) – whether to display the paper container with rounded corners
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.types.
OutlinedContainer
(rounded=True, **kwargs)¶ Bases:
fiftyone.operators.types.Container
Represents an elevated block for a view.
- Parameters
rounded (True) – whether to display the outlined container with rounded corners
Methods:
to_json
()-
to_json
()¶