Esempio n. 1
0
    def main_function(self, mode):

        external_stylesheets = [
            'https://raw.githubusercontent.com/rab657/explainx/master/explainx.css',
            dbc.themes.BOOTSTRAP, {
                'href': 'https://fonts.googleapis.com/css?family=Montserrat',
                'rel': 'stylesheet'
            }
        ]

        local = JupyterDash(__name__,
                            external_stylesheets=external_stylesheets,
                            suppress_callback_exceptions=True)

        local.title = "explainX.ai - Feature Interaction"

        local.layout = feature_interaction.layout_interaction(
            self.data, self.df_with_shap, local)

        if mode == None:
            import random
            port = random.randint(5000, 6000)
            return local.run_server(port=port)
        else:
            import random
            port = random.randint(5000, 6000)
            return local.run_server(mode='inline', port=port)
Esempio n. 2
0
    def main_function(self, mode):

        external_stylesheets = [
            'https://raw.githubusercontent.com/rab657/explainx/master/explainx.css',
            dbc.themes.BOOTSTRAP, {
                'href': 'https://fonts.googleapis.com/css?family=Montserrat',
                'rel': 'stylesheet'
            }
        ]
        local = JupyterDash(__name__,
                            external_stylesheets=external_stylesheets,
                            suppress_callback_exceptions=True)

        local.title = "explainX.ai - Local Level Explanation"

        local.layout = local_explanation.layout_local(self.shapley_values,
                                                      self.data,
                                                      self.df_with_shap, local)
        debug_value = False
        if mode is None:
            import random
            port = random.randint(6000, 7000)
            return local.run_server(port=port,
                                    debug=debug_value,
                                    dev_tools_ui=debug_value,
                                    dev_tools_props_check=debug_value,
                                    dev_tools_silence_routes_logging=True,
                                    dev_tools_hot_reload=True)
        else:
            import random
            port = random.randint(6000, 7000)
            return local.run_server(mode='inline',
                                    port=port,
                                    debug=debug_value,
                                    dev_tools_ui=debug_value,
                                    dev_tools_props_check=debug_value,
                                    dev_tools_silence_routes_logging=True,
                                    dev_tools_hot_reload=True)
Esempio n. 3
0
    def main_function(self, mode):

        external_stylesheets = [
            'https://raw.githubusercontent.com/rab657/explainx/master/explainx.css',
            dbc.themes.BOOTSTRAP, {
                'href': 'https://fonts.googleapis.com/css?family=Montserrat',
                'rel': 'stylesheet'
            }
        ]
        cohort = JupyterDash(__name__,
                             external_stylesheets=external_stylesheets,
                             suppress_callback_exceptions=True)

        cohort.title = "explainX.ai - Model Performance Analysis"

        cohort.layout = cohort_app.test_func(self.data, self.model, cohort)
        debug_value = False
        if mode == None:
            import random
            port = random.randint(4000, 5000)
            return cohort.run_server(port=port,
                                     debug=debug_value,
                                     dev_tools_ui=debug_value,
                                     dev_tools_props_check=debug_value,
                                     dev_tools_silence_routes_logging=True,
                                     dev_tools_hot_reload=True)
        else:
            import random
            port = random.randint(4000, 5000)
            return cohort.run_server(mode='inline',
                                     port=port,
                                     debug=debug_value,
                                     dev_tools_ui=debug_value,
                                     dev_tools_props_check=debug_value,
                                     dev_tools_silence_routes_logging=True,
                                     dev_tools_hot_reload=True)
Esempio n. 4
0
"""
from grid2viz.main_callbacks import register_callbacks_main
from grid2viz.layout import make_layout as layout

from grid2viz.src.episodes.episodes_clbk import register_callbacks_episodes
from grid2viz.src.overview.overview_clbk import (
    register_callbacks_overview, )  # as overview_clbk
from grid2viz.src.macro.macro_clbk import register_callbacks_macro  # as macro_clbk
from grid2viz.src.micro.micro_clbk import register_callbacks_micro  # as micro_clbk
"""
End Warning
"""

app.config.suppress_callback_exceptions = True

app.title = "Grid2Viz"
app.server.secret_key = "Grid2Viz"

##create layout
layout(app)

##create callbaks
register_callbacks_main(app)
register_callbacks_episodes(app)
register_callbacks_overview(app)
register_callbacks_macro(app)
register_callbacks_micro(app)


def app_run(port=8050, debug=False):
    app.run_server(port=port, debug=debug)
Esempio n. 5
0
def run_dash(path, search_criteria, mode=None):

    PLOTLY_LOGO = "https://images.plot.ly/logo/new-branding/plotly-logomark.png"
    # instantiating dash application
    #app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
    app = JupyterDash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP])
    app.title = "Resume Analyzer"

    files = [f for f in listdir(path) if isfile(join(path, f))]

    nlp = en_core_web_sm.load()

    search_bar = dbc.Row(
        [
            dbc.Badge(
                str(len(files)) + " Resume found",
                id="doc_info",
                href="#",
                color="warning",
                className="mr-1",
            ),
            dbc.Col(
                dbc.Button("Process ⚙️",
                           color="primary",
                           className="ml-2",
                           id="button",
                           n_clicks=1),
                width="12",
            ),
        ],
        no_gutters=True,
        className="ml-auto flex-nowrap mt-3 mt-md-0",
        align="center",
    )

    navbar = dbc.Navbar(
        [
            html.A(
                # Use row and col to control vertical alignment of logo / brand
                dbc.Row(
                    [
                        dbc.Col(html.Img(src=PLOTLY_LOGO, height="30px")),
                        dbc.Col(
                            dbc.NavbarBrand("Resume Analyzer",
                                            className="ml-2")),
                    ],
                    align="center",
                    no_gutters=True,
                ),
                href="https://shivanandroy.com",
            ),
            dbc.NavbarToggler(id="navbar-toggler"),
            dbc.Collapse(search_bar, id="navbar-collapse", navbar=True),
        ],
        color="dark",
        dark=True,
    )

    text = "**The table is filterable and sortable"

    summary = html.Div([
        dbc.Row([
            dbc.Col(dcc.Loading(
                html.Div([
                    html.Div(text, style={'font-size': '10px'}),
                    dash_table.DataTable(
                        id='table',
                        sort_action="native",
                        filter_action="native",
                        style_cell={
                            'font_family': 'Trebuchet MS',
                            'font_size': '15px',
                            'text_align': 'center'
                        },
                        style_header={
                            'backgroundColor': 'rgb(230, 230, 230)',
                            'fontWeight': 'bold'
                        },
                        style_header_conditional=[{
                            'if': {
                                'column_id': 'RANKING',
                            },
                            'backgroundColor': '#A8A8A8',
                            'color': 'black'
                        }, {
                            'if': {
                                'column_id': 'TOTAL SCORE',
                            },
                            'backgroundColor': '#A8A8A8',
                            'color': 'black'
                        }, {
                            'if': {
                                'column_id': 'RATING',
                            },
                            'backgroundColor': '#A8A8A8',
                            'color': 'black'
                        }])
                ])),
                    width={
                        'size': 10,
                        'offset': 1
                    })
        ],
                align='end')
    ])

    app.layout = html.Div([navbar, html.Br(), summary])

    @app.callback(
        [Output("table", "columns"),
         Output("table", "data")],
        [Input("button", "n_clicks")],
    )
    def toggle_navbar_collapse(n):
        if n is None:
            raise PreventUpdate
        else:
            files = [f for f in listdir(path) if isfile(join(path, f))]
            df = rank(path=path, search_criteria=search_criteria)
            return [{
                "name": i,
                "id": i
            } for i in df.columns], df.to_dict('records')

    if mode == "browser":
        app.run_server(debug=True)
    if mode == "notebook":
        app.run_server(debug=True, mode="inline", width=950)