예제 #1
0
                         value='lines')
        ],
                 style=third_width)
    ],
    style=dict(width='80%', display='none'),
    hidden=True)

graph_settings_container = html.Div(id='graph-settings-container',
                                    children=[plot_control_container])

graph_update_timer = dcc.Interval(
    id='update-timer',
    interval=2 * 1000  #ms
)

graph_update_trigger = dcc.Store(id='update-trigger')

visualization_container = html.Div(id='visualization-container',
                                   children=[
                                       dashboard_graph,
                                       graph_settings_container,
                                       graph_update_timer, graph_update_trigger
                                   ],
                                   style={
                                       'float': 'left',
                                       'width': '85%'
                                   })

###########################################################
#                      RIGHT COLUMN                       #
###########################################################
예제 #2
0
def shutdown():
    """
    Shutdown Flask server
    """
    func = request.environ.get("werkzeug.server.shutdown")
    if func is None:
        raise RuntimeError("Not running with the Werkzeug Server")
    func()


app.layout = html.Div(
    className="container-fluid",
    id="mainp",
    children=[
        dcc.Store(id="memory"),
        html.Div(
            className="row",
            children=[
                html.Div(
                    className="col",
                    children=[
                        html.H1(children="Complex Object Creator 2.0"),
                        dcc.Dropdown(
                            id="dropdown",
                            options=[
                                {"label": "Cartesian", "value": "Cartesian"},
                                {"label": "Polar", "value": "Polar"},
                                {"label": "Exp", "value": "Exp"},
                            ],
                            value="Cartesian",
예제 #3
0
                                # Graph
                                html.Div(
                                    className="nine columns card-left",
                                    children=[
                                        html.Div(
                                            className="bg-white",
                                            children=[
                                                html.H5("Last Updated:"),
                                                dcc.Input(id='h_date', value='0', type='hidden'),
                                                html.Div(id='date', style={'marginLeft': '43px'}),
                                                dcc.Graph(id="plot"),
                                            ]
                                        )
                                    ],
                                ),
                                dcc.Store(id="error", storage_type="memory"),
                                    ],
                                )
                                                    ]),

                dcc.Tab(label='STOCK SELECTION',
                        children=[html.Div([
                            html.Div([

                                html.Div([
                                    html.H4("Filter for Stock Selection:"),
                                    dcc.RadioItems(
                                        id='filter-radio',
                                        options=[{'label': i, 'value': i} for i in ['Long', 'Short', 'Long to Short',
                                                                                    'Short to Long']],
                                        value='Long',
예제 #4
0
파일: index.py 프로젝트: meta00/vital_sqi
                            disabled=True,
                            href="/views/dashboard3",
                            active="exact"),
            ],
            vertical=True,
            pills=True,
        ),
    ],
    style=SIDEBAR_STYLE,
)

content = html.Div(id="page-content", style=CONTENT_STYLE)

app.layout = html.Div([
    # Store dataframe
    dcc.Store(id='dataframe', storage_type='local'),
    dcc.Store(id='rule-set-store', storage_type='local'),
    dcc.Store(id='rule-dataframe', storage_type='local'),
    dcc.Location(id='url', refresh=False),
    sidebar,
    content
])

home_content = html.Div([
    html.H2("SQIs Table"),
    dcc.Upload(
        id='upload-data',
        children=html.Div(['Drag and Drop or ',
                           html.A('Select Files')]),
        style={
            'width': '100%',
예제 #5
0
             )
         ]),
     html.Div([
         html.A('Download activations',
                id='download-link',
                download='rawdata.csv',
                target='_blank',
                className='btn btn-success btn-block disabled'),
         html.Table(
             id='table-network-info',
             children=[],
         )
     ],
              id='network-info-panel'),
     html.Pre(id='output-activated-nodes'),
     dcc.Store(id='graph-pickled'),
     dcc.Store(id='data-selected-nodes'),
     dcc.Loading(children=[
         dcc.Store(id='data-activated-nodes'),
     ],
                 className='loading-box'),
 ],
          className='left-panel'),
 html.Div([
     dbc.Tabs(
         id='visualisation-tabs',
         children=[
             dbc.Tab(label='Network',
                     children=[
                         cyto.Cytoscape(id='cytoscape-elements',
                                        layout={
예제 #6
0
            html.Button(id='analyze',
                        n_clicks_timestamp=0,
                        children='Analyze',
                        title='Analyze text file to detect outliers')
        ],
                 style={
                     'float': 'center',
                     'display': 'inline-block'
                 }),
        dcc.Loading(id='parse summary and compute zscore',
                    fullscreen=True,
                    debug=True,
                    type='graph'),

        # Other dcc.Input()
        dcc.Store(id='df'),
        dcc.Store(id='subjects'),
        dcc.Store(id='dfcombined'),
        # other dcc.Store()
        html.Br(),
        html.Div(
            id='results',
            children=[
                html.Div(
                    'Analysis complete! Now you can browse through the summary below!',
                    id='analyze-status'),
                html.Br(),
                dcc.Link('See outliers summary', href='/summary'),
                html.Br(),
                dcc.Link('See outliers in graphs and GLM fitting',
                         id='compare-link',
예제 #7
0
import dash_core_components as dcc
import dash_html_components as html
import dash_daq as daq
import dash_bootstrap_components as dbc
import dash_cytoscape as cyto
from src import settings

base = html.Div([
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content'),
    dcc.Loading(type='graph',
                fullscreen=True,
                children=[
                    html.Div(id='container-data-store',
                             style={'display': 'none'},
                             children=[dcc.Store(id='data-store')])
                ])
])


def add_help(inside, tooltip_id=None, hide=True):
    """Wrapper html tag to display help tooltips."""
    style = {'display': 'inline-block', 'margin-right': '5px'}
    visibility = 'hidden' if hide else 'visible'
    try:
        inside.style
    except AttributeError:
        inside.style = {}
    inside.style.update(style)
    result = html.Span([
        inside,
예제 #8
0
def start():
    app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP], suppress_callback_exceptions=True)
    
    app.title = 'AutoML Benchmark'

    algorithms = ['autosklearn', 'h2o', 'tpot', 'autokeras', 'autogluon']

    CONTENT_STYLE = {
        "marginLeft": "22rem",
        "marginRight": "2rem",
        "padding": "2rem 1rem",
    }

    content = html.Div(id="page-content", style=CONTENT_STYLE)

    app.layout = html.Div([
        dcc.Location(id="url"), sidebar,
        dcc.Store(id="store_class_openml"), dcc.Store(id="store_reg_openml"),
        dcc.Store(id="store_class_kaggle"), dcc.Store(id="store_reg_kaggle"),
        dcc.Store(id="store_class_results_openml"), dcc.Store(id="store_reg_results_openml"),
        dcc.Store(id="store_class_results_kaggle"), dcc.Store(id="store_reg_results_kaggle"),
        dcc.Store(id="store_pipelines_class_openml"), dcc.Store(id="store_pipelines_reg_openml"),
        dcc.Store(id="store_pipelines_class_kaggle"), dcc.Store(id="store_pipelines_reg_kaggle"),
        dcc.Store(id="store_pipelines_results_class_openml"), dcc.Store(id="store_pipelines_results_reg_openml"),
        dcc.Store(id="store_pipelines_results_class_kaggle"), dcc.Store(id="store_pipelines_results_reg_kaggle"),
        content
    ])

    app.validation_layout=html.Div([openmlbenchmark, kagglebenchmark, testbenchmark, pastresultopenml, pastresultkaggle])


    @app.callback(Output("page-content", "children"), [Input("url", "pathname")])
    def render_page_content(pathname):
        return render_page_content_function(pathname)


    #populiamo i 4 store
    @app.callback(
        [Output('store_class_openml', 'data'), Output('store_reg_openml', 'data'), Output('store_pipelines_class_openml', 'data'), Output('store_pipelines_reg_openml', 'data'), Output('res-bench-openml-table-class', 'children'), Output('res-bench-openml-table-reg', 'children')],
        [Input('submit-openml', 'n_clicks')],
        [State('nmore', 'value'), State('ndf', 'value'), State("autosklearn-timelife", "value"), State("h2o-timelife", "value"), State("tpot-timelife", "value"), State("autokeras-timelife", "value"), State("autogluon-timelife", "value")]
    )
    def start_openml(n_clicks, nmore, ndf, as_tl, h2o_tl, t_tl, ak_tl, ag_tl):
        options = make_options(as_tl, h2o_tl, t_tl, ak_tl, ag_tl)
        return start_openml_function(nmore, ndf, options)



    #populiamo i 4 store
    @app.callback(
        [Output('store_class_kaggle', 'data'), Output('store_reg_kaggle', 'data'), Output('store_pipelines_class_kaggle', 'data'), Output('store_pipelines_reg_kaggle', 'data'), Output('res-bench-kaggle-table-class', 'children'), Output('res-bench-kaggle-table-reg', 'children')],
        [Input('submit-kaggle', 'n_clicks')],
        [State('kaggledataset', 'value'), State("autosklearn-timelife", "value"), State("h2o-timelife", "value"), State("tpot-timelife", "value"), State("autokeras-timelife", "value"), State("autogluon-timelife", "value")]
    )
    def start_kaggle(n_clicks, kaggledataset, as_tl, h2o_tl, t_tl, ak_tl, ag_tl):
        options = make_options(as_tl, h2o_tl, t_tl, ak_tl, ag_tl)
        return start_kaggle_function(kaggledataset, options)


    @app.callback(
        [Output('res-bench-test', 'children')],
        [Input('submit-test', 'n_clicks')],
        [State('dfid', 'value'), State('algorithms', 'value'), State("autosklearn-timelife", "value"), State("h2o-timelife", "value"), State("tpot-timelife", "value"), State("autokeras-timelife", "value"), State("autogluon-timelife", "value")]
    )
    def start_test(n_clicks, dfid, algorithms, as_tl, h2o_tl, t_tl, ak_tl, ag_tl):
        options = {
            'autosklearn': {'time': as_tl, 'type': 'minute/s'},
            'h2o': {'time': h2o_tl, 'type': 'minute/s'},
            'tpot': {'time': t_tl, 'type': 'generation/s'},
            'autokeras': {'time': ak_tl, 'type': 'epoch/s'},
            'autogluon': {'time': ag_tl, 'type': 'minute/s'},
        }
        return start_test_function(dfid, algorithms, options)


    
    #qui aggiorno i store di class e reg e stampo inizialmente le tabelle con i relativi risultati
    #OPNEML
    @app.callback(
        [Output('store_class_results_openml', 'data'), Output('store_reg_results_openml', 'data'),Output('store_pipelines_results_class_openml', 'data'), Output('store_pipelines_results_reg_openml', 'data'), Output('result-past-bench-openml-table-class', 'children'), Output('result-past-bench-openml-table-reg', 'children'), ],
        [Input('pastresultopenml', 'value')]
    )
    def get_store_past_bech_openml(timestamp): return get_store_past_bech_function(timestamp, 'OpenML')

    #KAGGLE
    @app.callback(
        [Output('store_class_results_kaggle', 'data'), Output('store_reg_results_kaggle', 'data'),Output('store_pipelines_results_class_kaggle', 'data'), Output('store_pipelines_results_reg_kaggle', 'data'), Output('result-past-bench-kaggle-table-class', 'children'), Output('result-past-bench-kaggle-table-reg', 'children'), ],
        [Input('pastresultkaggle', 'value')]
    )
    def get_store_past_bech_kaggle(timestamp): return get_store_past_bech_function(timestamp, 'Kaggle')


    #modfico stra scatter e histogram i risultati di classificazione
    @app.callback([Output('res-bench-openml-graph-class', 'children')], [Input("tabs-class", "active_tab"), Input('store_class_openml', 'data')])
    def render_tab_content_class(active_tab, store_class_openml): return render_tab_content_function(active_tab, store_class_openml, ('acc', 'f1'))

    @app.callback([Output('res-bench-kaggle-graph-class', 'children')], [Input("tabs-class", "active_tab"), Input('store_class_kaggle', 'data')])
    def render_tab_content_class(active_tab, store_class_kaggle): return render_tab_content_function(active_tab, store_class_kaggle, ('acc', 'f1'))

    @app.callback([Output('result-past-bench-openml-graph-class', 'children')], [Input("tabs-class", "active_tab"), Input('store_class_results_openml', 'data')])
    def render_tab_content_class(active_tab, store_class_results_openml): return render_tab_content_function(active_tab, store_class_results_openml, ('acc', 'f1'))

    @app.callback([Output('result-past-bench-kaggle-graph-class', 'children')], [Input("tabs-class", "active_tab"), Input('store_class_results_kaggle', 'data')])
    def render_tab_content_class(active_tab, store_class_results_kaggle): return render_tab_content_function(active_tab, store_class_results_kaggle, ('acc', 'f1'))


    #modfico stra scatter e histogram i risultati di regressione
    @app.callback([Output('res-bench-openml-graph-reg', 'children')], [Input("tabs-reg", "active_tab"), Input('store_reg_openml', 'data')])
    def render_tab_content_reg(active_tab, store_reg_openml): return render_tab_content_function(active_tab, store_reg_openml, ('rmse', 'r2'))

    @app.callback([Output('res-bench-kaggle-graph-reg', 'children')], [Input("tabs-reg", "active_tab"), Input('store_reg_kaggle', 'data')])
    def render_tab_content_reg(active_tab, store_reg_kaggle): return render_tab_content_function(active_tab, store_reg_kaggle, ('rmse', 'r2'))

    @app.callback([Output('result-past-bench-openml-graph-reg', 'children')], [Input("tabs-reg", "active_tab"), Input('store_reg_results_openml', 'data')])
    def render_tab_content_reg(active_tab, store_reg_results_openml): return render_tab_content_function(active_tab, store_reg_results_openml, ('rmse', 'r2'))

    @app.callback([Output('result-past-bench-kaggle-graph-reg', 'children')], [Input("tabs-reg", "active_tab"), Input('store_reg_results_kaggle', 'data')])
    def render_tab_content_reg(active_tab, store_reg_results_kaggle): return render_tab_content_function(active_tab, store_reg_results_kaggle, ('rmse', 'r2'))

    @app.callback(
        [Output(f"collapse-{algo}", "is_open") for algo in algorithms],
        [Input(f"{algo}-options", "n_clicks") for algo in algorithms],
        [State(f"collapse-{algo}", "is_open") for algo in algorithms],
    )
    def collapse_alogrithms_options(n1, n2, n3, n4, n5, is_open1, is_open2, is_open3, is_open4, is_open5): return collapse_alogrithms_options_function(n1, n2, n3, n4, n5, is_open1, is_open2, is_open3, is_open4, is_open5)

    @app.callback(
        [Output(f"{algo}-options", "disabled") for algo in algorithms],
        [Input("algorithms", "value")],
    )
    def disable_buttons_collapse(choice): return render_collapse_options(choice)

    @app.callback(
        [Output({"type":"modal-Pipelines", "index": MATCH}, "is_open"), Output({"type": 'body-modal-Pipelines', "index": MATCH}, 'children')],
        [Input({"type": "open-Pipelines", "index": MATCH}, "n_clicks"), Input({"type": "close-modal-Pipelines", "index": MATCH}, "n_clicks"), Input({"type": "open-Pipelines", "index": MATCH}, "value"), Input("url", "pathname"),
        Input('store_pipelines_class_openml', 'data'), Input('store_pipelines_reg_openml', 'data'),
        Input('store_pipelines_class_kaggle', 'data'), Input('store_pipelines_reg_kaggle', 'data'),
        Input('store_pipelines_results_class_openml', 'data'), Input('store_pipelines_results_reg_openml', 'data'),
        Input('store_pipelines_results_class_kaggle', 'data'), Input('store_pipelines_results_reg_kaggle', 'data'),],
        [State({"type":"modal-Pipelines", "index": MATCH}, "is_open")]
    )
    def show_hide_pipelines(n1, n2, value, path, s1, s2, s3, s4, s5, s6, s7, s8, is_open): 
        stores = {
            "/openml": [s1,s2],
            "/kaggle": [s3,s4],
            '/results-openml': [s5,s6],
            '/results-kaggle': [s7,s8],
        }
        s = stores.get(path, None)
        if s is not None:
            return show_hide_pipelines_function(s[0], s[1], n1, n2, value, is_open)
        else:
            return None, None


    app.run_server(host='0.0.0.0', port=8050, debug=True)
예제 #9
0
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

df = pd.read_csv(
    'https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv'
)

available_countries = df['country'].unique()

app.layout = html.Div([
    dcc.Graph(id='clientside-graph'),
    dcc.Store(id='clientside-figure-store',
              data=[{
                  'x': df[df['country'] == 'Canada']['year'],
                  'y': df[df['country'] == 'Canada']['pop']
              }]), 'Indicator',
    dcc.Dropdown(id='clientside-graph-indicator',
                 options=[{
                     'label': 'Population',
                     'value': 'pop'
                 }, {
                     'label': 'Life Expectancy',
                     'value': 'lifeExp'
                 }, {
                     'label': 'GDP per Capita',
                     'value': 'gdpPercap'
                 }],
                 value='pop'), 'Country',
    dcc.Dropdown(id='clientside-graph-country',
예제 #10
0
def get_create_study_div():
    """
    Returns the create study div

    :return: Create study div containing: title, input fields for study name, study duration and number of subjects and
            a list containing sensor + checkboxes
    """

    return html.Div(
        id='create-study-div',
        children=[
            dcc.Store(id='study-details',
                      data=get_default_study_details_dict()),
            dcc.Store(id='ema-details', data=get_default_ema_details_dict()),
            dcc.Store(id='passive-monitoring-details',
                      data=get_default_passive_monitoring_details_dict()),
            html.H2(children='Create new study'),
            html.Div(children=[
                html.Div(children=[
                    html.Span(className='create-span',
                              children='Study name*:'),
                    dcc.Input(id='create-study-name',
                              placeholder='Your study',
                              type='text',
                              debounce=True)
                ]),
                html.Div(children=[
                    html.Span(className='create-span',
                              children='Study duration*:'),
                    dcc.Input(id='create-study-duration',
                              placeholder='Days',
                              type='number',
                              min='1',
                              debounce=True)
                ]),
                html.Div(children=[
                    html.Span(className='create-span',
                              children='Number of subjects*:'),
                    dcc.Input(id='create-subject-number',
                              placeholder='Number of subjects',
                              type='number',
                              min='0',
                              debounce=True)
                ]),
                html.Div(children=[
                    html.Span(className='create-span',
                              children='Study description:'),
                    dcc.Textarea(id='create-study-description',
                                 placeholder="Enter study description",
                                 maxLength='500')
                ]),
                dcc.Checklist(id='modality-list',
                              options=modality_list,
                              labelStyle={'display': 'block'}),
                html.Div(id='data-div'),
                html.Button(id='create-study-button', children='Create study'),
                # is filled if user tries to create study, reset also other input fields
                dcc.Loading(children=[html.P(id='create-study-output-state')],
                            type='circle')
            ])
        ])
예제 #11
0
def contributions_layout(explainer, n_features=15, round=2, **kwargs):
    """returns layout for individual contributions tabs
    
    :param explainer: ExplainerBunch to build layout for
    :type explainer: ExplainerBunch
    :type title: str
    :param standalone: when standalone layout, include a a label_store, defaults to False
    :type standalone: bool
    :param hide_selector: if model is a classifier, optionally hide the positive label selector, defaults to False
    :type hide_selector: bool
    :param n_features: Default number of features to display in contributions graph, defaults to 15
    :type n_features: int, optional
    :param round: Precision of floats to display, defaults to 2
    :type round: int, optional
    :rtype: [dbc.Container
    """

    if explainer.is_classifier:
        index_choice_form = dbc.Form([
            dbc.FormGroup([
                html.Div([
                    dbc.Label(
                        'Range to select from (prediction probability or prediction percentile):',
                        html_for='prediction-range-slider'),
                    dcc.RangeSlider(id='prediction-range-slider',
                                    min=0.0,
                                    max=1.0,
                                    step=0.01,
                                    value=[0.5, 1.0],
                                    allowCross=False,
                                    marks={
                                        0.0: '0.0',
                                        0.1: '0.1',
                                        0.2: '0.2',
                                        0.3: '0.3',
                                        0.4: '0.4',
                                        0.5: '0.5',
                                        0.6: '0.6',
                                        0.7: '0.7',
                                        0.8: '0.8',
                                        0.9: '0.9',
                                        1.0: '1.0'
                                    },
                                    tooltip={'always_visible': False})
                ],
                         style={'margin-bottom': 25})
            ]),
            dbc.FormGroup([
                dbc.RadioItems(id='include-labels',
                               options=[
                                   {
                                       'label': explainer.pos_label_str,
                                       'value': 'pos'
                                   },
                                   {
                                       'label':
                                       'Not ' + explainer.pos_label_str,
                                       'value': 'neg'
                                   },
                                   {
                                       'label': 'Both/either',
                                       'value': 'any'
                                   },
                               ],
                               value='any',
                               inline=True),
                dbc.RadioItems(id='preds-or-ranks',
                               options=[
                                   {
                                       'label': 'Use predictions',
                                       'value': 'preds'
                                   },
                                   {
                                       'label': 'Use percentiles',
                                       'value': 'ranks'
                                   },
                               ],
                               value='preds',
                               inline=True)
            ])
        ])
    else:
        index_choice_form = dbc.Form([
            dbc.FormGroup([
                html.Div([
                    html.Div([
                        dbc.Label(
                            'Range of predicted outcomes to select from:',
                            html_for='prediction-range-slider'),
                        dcc.RangeSlider(
                            id='prediction-range-slider',
                            min=min(explainer.preds),
                            max=max(explainer.preds),
                            step=np.float_power(10, -round),
                            value=[min(explainer.preds),
                                   max(explainer.preds)],
                            marks={
                                min(explainer.preds):
                                str(np.round(min(explainer.preds), round)),
                                max(explainer.preds):
                                str(np.round(max(explainer.preds), round))
                            },
                            allowCross=False,
                            tooltip={'always_visible': False})
                    ],
                             style={'margin-bottom': 25})
                ]),
            ],
                          style={'margin-bottom': 25}),
        ])

    return dbc.Container([
    dbc.Row([
        dbc.Col([
            html.H2('Display prediction for:'),
            dbc.Input(id='input-index',
                        placeholder="Fill in index here...",
                        debounce=True),
            index_choice_form,
            dbc.Button("Random Index", color="primary", id='index-button'),
            dcc.Store(id='index-store'),
        ], md=6),

        dbc.Col([
             dcc.Loading(id="loading-model-prediction",
                         children=[dcc.Markdown(id='model-prediction')]),
        ], md=6),

    ], align="start", justify="between"),

    dbc.Row([
        dbc.Col([
            html.H3('Contributions to prediction'),
            dbc.Label('Number of features to display:', html_for='contributions-size'),
            html.Div([
                dcc.Slider(id='contributions-size',
                    min = 1, max = len(explainer.columns),
                    marks = {int(i) : str(int(i))
                                for i in np.linspace(
                                        1, len(explainer.columns_cats), 6)},
                    step = 1, value=min(n_features, len(explainer.columns_cats)),
                    tooltip = {'always_visible' : False}
                ),
            ], style={'margin-bottom':25}),

            dbc.Label('(click on a bar to display pdp graph)'),
            dcc.Loading(id="loading-contributions-graph",
                        children=[dcc.Graph(id='contributions-graph')]),

            html.Div(id='contributions-size-display', style={'margin-top': 20}),
            html.Div(id='contributions-clickdata'),
        ], md=6),

        dbc.Col([
            html.H3('Partial Dependence Plot'),
            dbc.Label("Plot partial dependence plot (\'what if?\') for column:", html_for='pdp-col'),
            dcc.Dropdown(id='pdp-col',
                options=[{'label': col, 'value':col}
                            for col in explainer.mean_abs_shap_df(cats=True)\
                                                        .Feature.tolist()],
                value=explainer.mean_abs_shap_df(cats=True).Feature[0]),
            dcc.Loading(id="loading-pdp-graph",
                    children=[dcc.Graph(id='pdp-graph')]),
        ], md=6)
    ]),
    dbc.Row([
        dbc.Col([
            html.H3('Contributions to prediction'),
            dash_table.DataTable(
                id='contributions_table',
                style_cell={'fontSize':20, 'font-family':'sans-serif'},
                columns=[{'id': c, 'name': c}
                            for c in ['Reason', 'Effect']],

            ),
        ], md=6),
    ]),
    ], fluid=True)
예제 #12
0
)
fig = go.Figure(data=mydata, layout=mylayout)

## Confusion Matrix
cm = pd.read_csv('analysis/conf_matrix.csv')

########### Initiate the app
external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
server = app.server
app.title=tabtitle

########### Layout

app.layout = html.Div(children=[
    dcc.Store(id='tmdb-store', storage_type='session'),
    dcc.Store(id='summary-store', storage_type='session'),
    html.Div([
        html.H1(['Horror Movie Predictor']),
        html.Div([
            html.Div([
                html.Div('Randomly select a movie summary'),
                html.Button(id='eek-button', n_clicks=0, children='EEK!', style={'color': 'rgb(255, 255, 255)'}),
                html.Div(id='movie-title', children=[]),
                html.Div(id='movie-release', children=[]),
                html.Div(id='movie-overview', children=[]),

            ], style={ 'padding': '12px',
                    'font-size': '22px',
                    # 'height': '400px',
                    'border': 'thick red solid',
예제 #13
0
        sort_action='custom',
        sort_mode='multi',
        sort_by=[],
        style_table={},
        tooltip={i: {
            'value': i,
            'use_with': 'both'
        }
                 for i in df0.keys()},
    )


app = dash.Dash(__name__)
app.layout = html.Div(className="row",
                      children=[
                          dcc.Store(id='filter_df_store'),
                          dcc.Link(id='clicking',
                                   children=["dfdf"],
                                   href='https://www.baidu.com'),
                          html.H4(
                              'factor分析',
                              style={
                                  "left": 5,
                                  "top": 5,
                                  "position": "absolute"
                              },
                          ),
                          html.Div(
                              id='factors_table-container',
                              style={
                                  "width": 800,
예제 #14
0
        dbc.Col(dcc.Graph(id='pca-variance-bar')),
        dbc.Col(dcc.Graph(id='pca-components-2d'))
    ]
)

num_viz_layout = dbc.Col(
    [   
        html.Br(),
        num_viz_header,
        num_viz_3d_dropdown,
        num_viz_3d_plot,
        html.Br(),
        num_viz_dropdown,
        num_viz_2d_plots
    ]
)

## Bring it all together
layout = dbc.Container(
    [
        dcc.Store(id='memory-output', storage_type='memory'),
        dbc.Col(
            [
                header,
                top_tabs,
                content
            ], align = 'stretch'
        )
    ], 
)
예제 #15
0
# Satellite L12-5 data
df_non_gps_h_1 = pd.read_csv(
    os.path.join(APP_PATH, os.path.join("data", "non_gps_data_h_1.csv")))
df_non_gps_m_1 = pd.read_csv(
    os.path.join(APP_PATH, os.path.join("data", "non_gps_data_m_1.csv")))
df_gps_m_1 = pd.read_csv(
    os.path.join(APP_PATH, os.path.join("data", "gps_data_m_1.csv")))
df_gps_h_1 = pd.read_csv(
    os.path.join(APP_PATH, os.path.join("data", "gps_data_h_1.csv")))

# Root
root_layout = html.Div(
    id="root",
    children=[
        dcc.Store(id="store-placeholder"),
        dcc.Store(
            id="store-data",
            data={
                "hour_data_0": {
                    "elevation":
                    [df_non_gps_h_0["elevation"][i] for i in range(60)],
                    "temperature":
                    [df_non_gps_h_0["temperature"][i] for i in range(60)],
                    "speed": [df_non_gps_h_0["speed"][i] for i in range(60)],
                    "latitude": [
                        "{0:09.4f}".format(df_gps_h_0["lat"][i])
                        for i in range(60)
                    ],
                    "longitude": [
                        "{0:09.4f}".format(df_gps_h_0["lon"][i])
예제 #16
0
                        ),
                        id='navbar-collapse2',
                        navbar=True,
                    ), ))
        ], ),
    # color='dark',
    # dark=True,
    className='mb-5',
)

###################################################################################################################

body1 = html.Div([
    dbc.Container(
        [
            dbc.Row(dbc.Col(dcc.Store(id='memory-output'))),
            dbc.Row(dbc.Col(navbar)),
            dbc.Row(
                dbc.Col(
                    html.H3('Financial Dashboard for Euronext Stock Exchange',
                            style={'text-align': 'center'}))),
            # dbc.Row(dbc.Col(html.Br())),
            dbc.Row([
                dbc.Col(
                    html.Div(dbc.Input(id="input", value='ABI',
                                       debounce=True))),
                dbc.Col(html.Div(id='output', style={'text-align': 'center'})),
                dbc.Col(html.Div(id='output2', style={'text-align': 'center'
                                                      })),
                dbc.Col(html.Div(id='output3', style={'text-align': 'center'
                                                      })),
예제 #17
0
app.config.suppress_callback_exceptions = True

server = app.server

df = pd.read_csv('game_set_outcome.csv', delimiter=';')


#function to find bulletpoints and seperate lines based on a bulletpoint
def textDecoder(text):
    lines = text.split(u'\u2022')
    return ([html.Li(i) for i in lines if i is not ' ' and i is not ''])


body = html.Div([
    dcc.Store(id='memory'),
    html.Div([
        html.H1("Beat the 'rithm.", className="title title--adjusted"),
        html.Div([
            html.Div('Your bonus: $'),
            html.Div(children="0", id="bonus", className="bonus__count"),
        ],
                 className="bonus flex"),
    ],
             className="header"),
    html.Div(
        [
            html.Div([
                html.Div([
                    html.Div('', className="circle"),
                    html.Div('Job vacancy'),
예제 #18
0
history_list = dict(zip(["ramped", "sinusoidal", "dcv"], [[], [], []]))
max_plots = 2
history_dict = {str(key): {} for key in range(0, max_plots)}
for e_type in ["ramped", "sinusoidal", "dcv"]:
    for exp in [
            "current_time", "current_voltage", "voltage_time", "fft", "harms"
    ]:
        for history in ["", "_history"]:
            if e_type != "dcv":
                if exp == "harms":
                    for i in range(0, num_harms):
                        id_str = ("_").join([e_type, exp,
                                             str(i), "store"]) + history
                        if history == "":
                            store_list[e_type].append(id_str)
                            storage_array.append(dcc.Store(id=id_str))
                        else:
                            history_list[e_type].append(id_str)
                            storage_array.append(
                                dcc.Store(id=id_str, data=history_dict))
                else:
                    id_str = ("_").join([e_type, exp, "store"]) + history
                    if history == "":
                        store_list[e_type].append(id_str)
                        storage_array.append(dcc.Store(id=id_str))
                    else:
                        history_list[e_type].append(id_str)
                        storage_array.append(
                            dcc.Store(id=id_str, data=history_dict))

            elif e_type == "dcv":
예제 #19
0
        ],
                 className="six columns"),
        html.Div([
            html.H3('Column 2'),
            dcc.Graph(id='g2', figure={'data': [{
                'y': [1, 2, 3]
            }]})
        ],
                 className="six columns"),
    ],
             className="row"),
])

day_wise_layout = html.Div(
    [
        dcc.Store(id="aggregate_data"),
        # empty Div to trigger javascript file for graph resizing
        html.Div(id="output-clientside"),
        html.Div([
            html.P("Select Cotegory:", className="control_label"),
            dcc.Dropdown(
                id="category",
                options=[{
                    'label': i,
                    'value': i
                } for i in day_wise.columns.tolist()[1:]],
                value=f"{day_wise.columns.tolist()[1:][0]}",
                className="dcc_control",
            ),
        ],
                 className="pretty_container",
예제 #20
0
    },
)

controls = dbc.InputGroup(children=[
    dbc.Input(
        id="user-input", placeholder="Write to the chatbot...", type="text"),
    dbc.InputGroupAddon(dbc.Button("Submit", id="submit"),
                        addon_type="append"),
])

app.layout = dbc.Container(
    fluid=False,
    children=[
        Header("Digital Legal and Compliance Officer", app),
        html.Hr(),
        dcc.Store(id="store-conversation", data=""),
        conversation,
        controls,
        dbc.Spinner(html.Div(id="loading-component")),
    ],
)


@app.callback(Output("display-conversation", "children"),
              [Input("store-conversation", "data")])
def update_display(chat_history):
    return [
        textbox(x, box="user") if i % 2 == 0 else textbox(x, box="AI")
        for i, x in enumerate(chat_history.split("<split>")[:-1])
    ]
예제 #21
0
                dbc.NavLink("Page 1", href="/page-1", id="page-1-link"),
                dbc.NavLink("Page 2", href="/page-2", id="page-2-link"),
                dbc.NavLink("Page 3", href="/page-3", id="page-3-link"),
            ],
            vertical=True,
            pills=True,
        ),
    ],
    id="sidebar",
    style=SIDEBAR_STYLE,
)

content = html.Div(id="page-content", style=CONTENT_STYLE)

app.layout = html.Div([
    dcc.Store(id='side_click'),
    dcc.Location(id="url"),
    navbar,
    sidebar,
    content,
], )


@app.callback([
    Output("sidebar", "style"),
    Output("page-content", "style"),
    Output("side_click", "data"),
], [Input("btn_sidebar", "n_clicks")], [
    State("side_click", "data"),
])
def toggle_sidebar(n, nclick):
예제 #22
0
    dbc.FormGroup([dbc.Button('Atualizar portfólio', id='btn-portfolio')],
                  **_styles),
    # gerar recomendações
    dbc.FormGroup([dbc.Button('Gerar recomendações', id='btn-update')],
                  **_styles)
])

view_portfolio = dbc.Row([html.Div(id='table-portfolio')])

view_recommends = dbc.Row([html.Div(id='table-recommends')])

app.layout = dbc.Container([
    # barra superior
    navbar,
    # data stores
    dcc.Store('ids-store', storage_type='session'),
    dcc.Store('recommends-store', storage_type='session'),
    # alertas
    # dbc.Alert("Dados carregados com sucesso!", color="success", fade=True, duration=3000),
    # dbc.Alert("Erro na carga dos dados!", color="danger", fade=True, duration=3000),
    # inicio da pagina
    welcome,
    dbc.Row([
        # barra lateral
        dbc.Col([options], md=3),
        # corpo da pagina
        dbc.Col([
            dbc.Row([dcc.Loading([view_portfolio])]),
            dbc.Row([dcc.Loading([view_recommends])])
        ],
                md=9)
예제 #23
0
                #Add click data here
            ),
            html.Div(
                #add relayout data here
            ),
            html.Div([
                html.A(
                    "Code developed using the example Dash App Repositiory on Github",
                    href=GITHUB_LINK,
                    target="_blank",
                )
            ]),
        ],
        className="one-third column app__right__section",
    ),
    dcc.Store(id="annotation_storage"),
])


@app.callback(
    Output("cube-graph", "figure"),
    [
        Input("cube-graph", "clickData"),
        Input("radio-options", "value"),
    ],
    [State("cube-graph", "figure")],
)
def cube_graph_handler(click_data, val, figure):

    if figure["data"][0]["name"] != val:
        figure["data"] = create_mesh_data(val)
예제 #24
0
            style_table={'overflowY': 'auto'},
            style_cell={'textAlign': 'left', 'minWidth': '100px', 'width': '100px', 'maxWidth': '100px'},
            dropdown={
                'Class': {
                    'options': diagnosises
                },
            },
        )
    ]),
    html.Hr(className="my-2"),
    html.Div([
        html.Button("Export Table to Excel", id='excel_btn', n_clicks=0),
        html.Button("Submit Table", id='submit_btn', n_clicks=0),
        # for notification when saving to excel
        html.Div(id='excel_notification_placeholder', children=[]),
        dcc.Store(id="excel_notification_store", data=0),
        dcc.Interval(id='excel_notification_nterval', interval=1000),
        Download(id="download"),
        # for notification when saving to database
        html.Div(id='db_notification_placeholder', children=[]),
        dcc.Store(id="db_notification_store", data=0),
        dcc.Interval(id='db_notification_interval', interval=1000),

    ]),
])


@app.callback(
    [Output('table', 'data'),
     Output('canvas', 'image_content')],
    [Input('canvas', 'json_data')],
예제 #25
0
from Callbacks.FIgPca import PcaFirst
from Pages.SearchTweets import parse_contents
from Components.Table3 import generate_table2
#
from API.Cleaning_Tweets import df_with_clean_text
from API.Cleaning_Tweets import df_with_clean_text2
from API.Cleaning_Tweets import Give_The_Graph, Give_The_Graph_Word

#
app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])
app.config.suppress_callback_exceptions = True
len_data = 3500

app.layout = html.Div([
    # Save the tweets Searched by hashtag or name
    dcc.Store(id='session', data=[]),
    # Save the tweets Searched by the name of the owner of the count
    dcc.Store(id='session2', data=[]),
    dcc.Store(id='DataFrameUploaded', data=[]),
    # Save the Data Cleaned
    dcc.Store(id="clean_df", data=[]),
    dcc.Store(id="NMF_Topic_word", data=[]),
    # Save the Confusion Matrix
    dcc.Store(id="Confusion_Matrix", data=[]),
    dcc.Location(id='url', refresh=False),
    html.Div(id='page-content')
])

page_1 = layout1

예제 #26
0
    meta_tags=[{
        "name": "viewport",
        "content": "width=device-width, initial-scale=1"
    }],
)
server = app.server
app.config["suppress_callback_exceptions"] = True

key = 'RGAPI-9724b32a-f354-408c-8cde-8fdcc35e01fa'
champions = aq.championsid(key)
queues = aq.get_queuesid(key)

app.layout = html.Div(
    id="big-app-container",
    children=[
        dcc.Store(id="summoner-name"),
        dcc.Store(id="account-id"),
        dcc.Store(id="match-list"),
        dcc.Store(id="game-id"),
        dcc.Store(id="match-info"),
        dcc.Store(id="players-info"),
        dcc.Store(id="timeline"),
        dcc.Store(id="frames"),
        dcc.Store(id="events"),
        dcc.Store(id="golddiff"),
        dcc.Store(id="players_stats_df"),
        t1.build_banner(),
        #dcc.Interval(id="interval-component", interval=2 * 1000,  n_intervals=50, disabled=True,),
        html.Div(
            id="app-container",
            children=[
예제 #27
0
 def layout(self):
     return html.Div(
         [
             html.Div(
                 style={"marginLeft": "20%"},
                 children=[
                     html.Label(
                         "Tornado Plot",
                         style={"textAlign": "center", "font-weight": "bold"},
                     ),
                     html.Div(
                         style=self.set_grid_layout("1fr 1fr"),
                         children=[html.Label("Reference:"), html.Label("Scale:"),],
                     ),
                     html.Div(
                         style=self.set_grid_layout("1fr 1fr"),
                         children=[
                             dcc.Dropdown(
                                 id=self.ids("reference"),
                                 options=[
                                     {"label": r, "value": r} for r in self.sensnames
                                 ],
                                 value=self.initial_reference,
                                 clearable=False,
                             ),
                             dcc.Dropdown(
                                 id=self.ids("scale"),
                                 options=[
                                     {"label": r, "value": r}
                                     for r in ["Percentage", "Absolute"]
                                 ],
                                 value="Percentage",
                                 clearable=False,
                             ),
                         ],
                     ),
                     html.Div(
                         style=self.set_grid_layout("1fr 1fr"),
                         children=[
                             html.Label(
                                 style={"marginTop": "10px"},
                                 children="Cut by reference:",
                             )
                         ],
                     ),
                     html.Div(
                         style=self.set_grid_layout("1fr 1fr"),
                         children=[
                             dcc.RadioItems(
                                 labelStyle={"display": "inline-block"},
                                 id=self.ids("cut-by-ref"),
                                 options=[
                                     {"label": "Off", "value": False},
                                     {"label": "On", "value": True},
                                 ],
                                 value=False,
                             ),
                             html.Button(
                                 style={
                                     "position": "relative",
                                     "top": "-50%",
                                     "fontSize": "10px",
                                 },
                                 id=self.ids("reset"),
                                 children="Clear selected",
                             ),
                         ],
                     ),
                     wcc.Graph(
                         id=self.ids("tornado-graph"),
                         config={"displayModeBar": False},
                     ),
                     dcc.Store(id=self.ids("storage")),
                     dcc.Store(id=self.ids("click-store")),
                 ],
             )
         ]
     )
예제 #28
0
           "espacios de reflexión e investigación. Partiendo de una experiencia personal en un piso compartido cubierto " \
           "de humedades, surge una idea de relación entre dos eventos que, pese a representar una razonable contraposición, " \
           "acogen en su naturaleza comportamientos similares."

message2 = " Lo que a primera vista puede parecer insignificante, como " \
           "una pequeña gota de agua, si su reproducción se repite de forma constante puede llegar a desarrollar el desbordamiento " \
           "de un caudal irrefrenable, desdibujando y construyendo al tiempo la imagen de un nuevo paisaje en tránsito. " \
           "Todo este proceso de transformación puede verse no sólo en la vivienda y su imagen, sino en la corporalidad y " \
           "en los hábitos del individuo que la ocupa."


app.title="Paisajes en zonas de tránsito"
# Create app layout
app.layout = html.Div(
    [
        dcc.Store(id="current-gray"),
        # empty Div to trigger javascript file for graph resizing
        html.Div(id="output-clientside"),
        html.Div(
            [
                html.Div(
                    [
                        html.H2(
                            "Paisajes en zonas de tránsito",
                            style={"margin-bottom": "0px"},
                        ),
                        html.H4(
                            "Orografía emocional de la vivienda", style={"margin-top": "0px"}
                        ),
                    ]
                )
예제 #29
0
                            #{'label': '6', 'value': 6}
                        ],
                        placeholder='select max degree'
                        #,value=3
                    ),html.Button('Network',
                                  id='network-button',
                                  n_clicks=0,
                                  className='six columns')
                ])
                ]
            )

        ]
    ),
    html.Div(children=[
        dcc.Store(id='channel-items-store'),
        dcc.Store(id='graph-dict-store'),
        html.Div(id='results-section'),
        html.Div(id='graph_network',
                 style = dict(visibility='hidden'),
                 children=[
        dcc.Graph(
            id='plotly',
            style={'height': '100vh','width': '100%','textAlign': 'center'},
            figure=BLANK_FIG,
            responsive=True
            )
        ])
    ])

])
예제 #30
0
def server_layout(mode=None):
    #return the layout of the GUI
    session_id = str(uuid.uuid4())

    #variable, distribution selection panel
    selection_panel = html.Div(id='selection-panel',children=[
        html.Div(id='selected-column-panel',children=[
            html.Div(id='selected-column-sec1-panel',children=[
                drc.NamedDropdown(
                    name='Select series',
                    id='selected-series',
                    searchable=False,
                    clearable=False
                ),
                dcc.Checklist(
                    id='apply-log-transform',
                    options=[{'label':' Apply log transform','value':'logtransform'}
                ]),
            ]),
            drc.NamedTextarea(
                id='series-characteristics',
                name='Series characteristics',
                cols='50',
                rows='2',
                readOnly='readOnly'
            ),
        ]),
        html.Div(id='apply-panel',children=[
            html.Div(id='apply-sec1-panel',children=[
                drc.NamedDropdown(
                    id='fitted-distributions',
                    name='Fitted distribution',
                    options=[
                        {'label': ' '+ v[0], 'value': k}
                        for k,v in dist_par_template.items() if k != 'native' and v[2]
                    ],
                    value='normal',
                    searchable=False,
                    clearable=False
                ),
            ]),
            # html.Div(id='apply-sec1b-panel',children=[
            #     drc.NamedDropdown(
            #         id='plotting-distributions',
            #         name='Probability scale',
            #         options=[
            #             {'label': ' '+ v[0], 'value': k}
            #             for k,v in dist_par_template.items() if v[2]
            #         ],
            #         value='native',
            #         searchable=False,
            #         clearable=False
            #     ),
            # ]),
            html.Div(id='apply-sec2a-panel',children=[
                html.Button('Fit',id='fit-button',n_clicks=0),
            ]),
            #dcc.Checklist(
            #    id='show-y-log',
            #    options=[{'label':' Show y-axis in log scale','value':'true'}
            #]),
        ]),
        html.Label(id='graph-refresh'),
        dcc.Store(
            id='graph-refresh-hidden',
            data=0
        ),
        html.Div(id='message-panel',children=[""]),

    ])

    #variable, distribution selection panel
    par_panel = html.Div(id='fitted-panel',children=[
        html.Div(id='fitted-sec1-panel',children=[
            drc.NamedTextarea(
                id='fitted-par',
                name='Estimated distribution parameters',
                readOnly='readOnly',
                cols= 40,
                rows= 3
            ),
            drc.NamedTextarea(
                id='estimated-quantiles',
                name='Estimated quantiles',
                readOnly='readOnly',
                cols= 40,
                rows= 3
            ),
        ])
    ])

    upload_panel = html.Div(id='last-card',children=[
        dcc.Upload(
            id='upload-data',
            children=html.Div([
                'Drag and Drop or ',
                html.A('Select File')
            ]),
            style={
                'lineHeight': '60px',
                'borderWidth': '1px',
                'borderStyle': 'dashed',
                'borderRadius': '5px',
                'textAlign': 'center',
            }
        ),
        html.Label('''File upload limited to < %0.0f Kb, containing no more than %d rows and %d columns'''%(configs['max_file_size']/1024,configs['max_file_rows'],configs['max_file_cols'])),
        html.Label('',id='data-filename'),
        html.Label('',id='data-description'),
        html.Div(id='table-panel',children=[
            dash_table.DataTable(
                id='attribute-table',
                columns=[],
                row_selectable='multi',
                editable=False,
                style_header={
                    'textAlign': 'center',
                    'fontWeight': 'bold',
                    'color': 'black',
                },
                style_cell={
                    'padding': '2px',
                    '--selected-background': 'grey',
                    'color': 'black',
                },
                style_data_conditional=[
                    {
                        'if': {'row_index': 'odd'},
                        'backgroundColor': 'rgb(248, 248, 248)'
                    }
                ],
                #locale_format= '0.3',
            )
        ],style={'visibility':'none','display':'none'}),
    ])

    chart_panel = html.Div(id='chart-panel',children=[
        dcc.Loading(id = "loading-icon", children=[
            dcc.Graph(
                id='graph',
                figure={
                },
                responsive=True,
                config=graph_config,
                style={'display':'none'}
            )
        ]),
    ],
    style={'visibility':'none'})


    layout = html.Div(
        id="body",
        className="container scalable",
        children=[
            visdcc.Run_js(id = 'chart-updated-js'),
            visdcc.Run_js(id = 'chart-unupdated-js'),
            visdcc.Run_js(id = 'error-display-js'),
            dcc.Store(id='error-display',data=''),
            html.Title(title=configs['title']),
            #hidden session id
            #row 1 for title
            html.Div(id='top-panel',children=[
                html.H5(id='app-title',children=
                    '''Distribution Fitting and Analysis Tool.
                    This tool is only for demostration porpuses''',
                    style={"margin-bottom": "0px"},
                ),
            ],className="row flex-display"),
            #second row layout
            html.Div(id='main-panel',children=[
                html.Div(id='left-panel',children=[
                    upload_panel
                ]),
                html.Div(id='output-panel',children=[
                    selection_panel,
                    par_panel,
                    chart_panel
                ],style={'visibility':'none','display':'none'}),
            ]),
            #row 4 is the footer
            html.Div(id='footer-panel',children=[
                '''
                    A web application built on top of Dash (v%s) (framework for Python) by
                    Exequiel Sepúlveda and Dmitri Kavetski.'''%(dash.__version__)
            ]),
        ],
    )
    return layout