edflow.explore module

Summary

Functions:

custom_visualizations

Displays custom visualizations in streamlit

display

Display item in streamlit

display_default

Find out how item could be displayed

explore

Explore dataset specified in config

selector

Show select box to choose display mode of obj in streamlit

show_example

Show example of dataset

Reference

edflow.explore.display_default(obj)[source]

Find out how item could be displayed

Parameters

obj (Any) – Item of example

Returns

One of “Image”, “Text”, “Flow”, “Segmentation”, “None”

Return type

str

edflow.explore.display(key, obj)[source]

Display item in streamlit

Parameters
  • key (str) – Subheader to be displayed

  • obj (Any) – Item of example to be displayed

edflow.explore.selector(key, obj)[source]

Show select box to choose display mode of obj in streamlit

Parameters
  • key (str) – Key of item to be displayed

  • obj (Any) – Item to be displayed

Returns

Selected display method for item

Return type

str

edflow.explore.custom_visualizations(ex, config)[source]

Displays custom visualizations in streamlit

The visualizations can be inserted to the config via their import path. Everyone can implement a custom visualization for an example.

The visualization functions must accept the example and config as positional arguments.

Examples

Add visualizations to the text box with their import path. For example:

edflow.util.edexplore.display_flow_on_image

A valid visualization function could look like for example:

import streamlit as st
from edflow.util.edexplore import isimage, st_get_list_or_dict_item

def my_visualization(ex, config):
    st.write("This is my visualization")

    image1, image1_key = st_get_list_or_dict_item(ex, "image1", filter_fn=isimage)

    st.image((image1 + 1) / 2)

    image2 = ex["image2"]
    image3 = ex["image3"]

    st.image((image2 + 1) / 2)
    st.image((image3 + 1) / 2)

Visualizations can be displayed by default, if they are specified in the config. An example for the configuration yaml file would be:

edexplore:
    visualizations:
        custom:
            vis1:
                path: my_package.visualizations.my_visualization
Parameters
  • ex (dict) – Example to be visualized

  • config (dict) – Edexplore config

edflow.explore.show_example(dset, idx, config)[source]

Show example of dataset

Parameters
  • dset (DatasetMixin) – Dataset to be shown

  • idx (int) – Index to be shown

  • config (dict) – Config used to show example

edflow.explore.explore(config, disable_cache=False)[source]

Explore dataset specified in config

Parameters
  • config (dict) – Edflow config dict used to explore dataset

  • disable_cache (bool, optional) – Disable cache while loading dataset, by default False