--- title: Graphical user interface keywords: fastai sidebar: home_sidebar summary: "Simple GUI with ipywidgets." description: "Simple GUI with ipywidgets." nb_path: "nbs/08_gui.ipynb" ---
{% raw %}
{% endraw %} {% raw %}
{% endraw %}

Descriptions with tuples of name, tooltip, and link

Helper Functions

{% raw %}

set_css_in_cell_output[source]

set_css_in_cell_output()

{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %}

Widgets

Base Widgets

{% raw %}

class ZipUpload[source]

ZipUpload(path=None, layout=None)

Widgets upload and extract zip files

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t = ZipUpload()
t.widget
{% endraw %} {% raw %}

class ItemsPerPage[source]

ItemsPerPage(path=None, plot_fn=None, items={}, srt=True, srt_by='name', srt_index=0, **kwargs)

Dropdown to show n items per page

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t = ItemsPerPage(srt_index=1)
t.widget
{% endraw %} {% raw %}

class BaseParamWidget[source]

BaseParamWidget(config=None)

Parameter Widget Base Class

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class BaseUI[source]

BaseUI(config=None, path=None)

Base UI for different steps

{% endraw %} {% raw %}
{% endraw %}

Path Widgets

{% raw %}

class PathSelector[source]

PathSelector(start_dir, select_name='Select', select_file=False, tooltip=None)

Widgets to browse and select files or directories

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t = PathSelector('')
display(t.button, t.dialog)
{% endraw %} {% raw %}

class PathDownloads[source]

PathDownloads(*args, **kwargs) :: PathSelector

Widgets to browse and download files or directories

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t = PathDownloads('', select_file=True)
display(t.button, t.dialog)
{% endraw %} {% raw %}

class PathConfig[source]

PathConfig(*args, **kwargs) :: PathSelector

Widgets to browse and and load config file

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t = PathConfig('', select_file=True)
display(t.button, t.dialog)
{% endraw %}

Grund Truth Estimation Widgets

{% raw %}
{% endraw %} {% raw %}

class GTDataSB[source]

GTDataSB(path=None)

Layout for Grund Truth Estimation "Data" Section

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=GTDataSB()
t.widget
{% endraw %} {% raw %}

class GTEstSB[source]

GTEstSB(path=None)

Layout for Grund Truth Estimation "Data" Section

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=GTEstSB()
t.widget
{% endraw %} {% raw %}
class GTSimSB:
    'Layout for Expert Similarity "Data" Section'
    
    #Hints
    txt = 'Get statistics on segmentation similarities <br>'
    hints = w.HTML(txt)
    
    grid = w.GridspecLayout(4, GRID_COLS, width='100%',  grid_gap="0px", align_items='center')
    
    #Labels
    #grid[0, :] = w.Label('Simultaneous truth & performance level estimation')
    grid[0, 0] = w.HTML("Inter Experts")
    grid[1, 0] = w.HTML("GT vs Experts")
    grid[2, :] = w.HTML('<hr>')
    grid[3, 0] = w.Label('Downloads')
    
       
    #Intercoder sim
    inter = w.Button(description='Get statistics', layout=w.Layout(width='auto'),
                      tooltip='Calculate intercoder (inter-expert) agreement')
    grid[0, 1:] = inter
    
    #GT vs Experts
    gt_exp = w.Button(description='Get statistics', layout=w.Layout(width='auto'),
                  tooltip='Calculate agreement between expert segmentation masks and estimated ground truth')
    grid[1, 1:] = gt_exp
    
    #Final Widget
    widget = w.VBox([hints,grid])
    
    def __init__(self, path=None):
        path = path or Path('.') 
        self.down  = PathDownloads(path, 'Select', tooltip='Click to download file or directory')
        self.grid[3, 1:] = self.down.button    
{% endraw %} {% raw %}
t=GTSimSB()
t.widget
{% endraw %}

Grund Truth Estimation UI

{% raw %}

class GTEstUI[source]

GTEstUI(hide=False, **kwargs) :: BaseUI

UI for ground truth estimation

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=GTEstUI()
t.sb_acc
{% endraw %}

Train Widgets

{% raw %}
{% endraw %} {% raw %}

class TrainDataSB[source]

TrainDataSB(path=None, **kwargs) :: BaseParamWidget

Layout for "Training Data" Section

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=TrainDataSB('')
t.widget
{% endraw %} {% raw %}

class TrainModelSB[source]

TrainModelSB(**kwargs) :: BaseParamWidget

Layout for "Ensemble Training"

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=TrainModelSB()
t.widget
{% endraw %} {% raw %}

class TrainValidSB[source]

TrainValidSB(path=None, **kwargs) :: BaseParamWidget

Layout for "Validation" Section

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=TrainValidSB()
t.widget
{% endraw %}

Pop-Up Widgets

{% raw %}

class LRWidget[source]

LRWidget()

Widget for Learning Rate Finder

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t = LRWidget()
t.widget.layout.display = "block"  
t.widget
{% endraw %} {% raw %}

class BasePopUpParamWidget[source]

BasePopUpParamWidget(**kwargs) :: BaseParamWidget

Parameter Pop-Up Widget Base Class

{% endraw %} {% raw %}
{% endraw %} {% raw %}
{% endraw %} {% raw %}

class ParamWidget[source]

ParamWidget(**kwargs) :: BasePopUpParamWidget

Widget for custom training parameters

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=ParamWidget(config=Config(bs=8))
t.widget.layout.display = "block"    
t.widget
{% endraw %} {% raw %}
{% endraw %} {% raw %}

class MWWidget[source]

MWWidget(**kwargs) :: BasePopUpParamWidget

Widget to customize mask weights

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=MWWidget(config=Config(bws=5))
t.widget.layout.display = "block"  
t.widget
{% endraw %}

Train UI

{% raw %}

class TrainUI[source]

TrainUI(hide=False, **kwargs) :: BaseUI

UI for ensemble training

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=TrainUI('')
t.sb_acc
{% endraw %}

Prediction Widgets

{% raw %}
{% endraw %} {% raw %}

class PredInputSB[source]

PredInputSB(path=None)

Layout for "Data and Ensemble" Section

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=PredInputSB('')
t.widget
{% endraw %} {% raw %}

class PredSB[source]

PredSB(path=None, **kwargs) :: BaseParamWidget

Layout for "Prediction and Quality Control" Section

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=PredSB()
t.widget
{% endraw %}

Prediction UI

{% raw %}

class PredUI[source]

PredUI(hide=False, **kwargs) :: BaseUI

UI for prediction of new data

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t=PredUI('')
t.sb_acc
{% endraw %}

GUI

{% raw %}

class GUI[source]

GUI(path=Path('.'), reinit=False) :: GetAttr

GUI for deepflash2

{% endraw %} {% raw %}
{% endraw %} {% raw %}
t = GUI()
{% endraw %}