import pandas as pd df = pd.read_csv('/Users/code/Documents/Code_Immersives/Project/Term1Final/fourStations.csv') external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) features = df.columns Days = df['DAY'].unique() app = dash.Dash() app.layout = html.Div([ html.Div([ html.Label('DAY'), dcc.Dropdown( id='DAY', options=[{'label': i, 'value': i} for i in Days], value='', placeholder='Select...', multi=True ) ], style={'width': '20%', 'display': 'inline-block', 'margin-bottom': '20px'}), html.Div([ html.Label('HOUR'), dcc.Slider( id='HOUR-slider', min=df['HOUR'].min(),
def map_view_layout(self) -> html.Div: return html.Div( children=[ wcc.FlexBox( children=[ html.Div( children=[ html.Label( style={ "font-weight": "bold", "textAlign": "center", }, children="Select surface", ), dcc.Dropdown( id=self.ids("map-dropdown"), options=[ {"label": name, "value": name} for name in self.surfacenames ], value=self.surfacenames[0], clearable=False, persistence=True, persistence_type="session", ), ] ), ], ), html.Div( style={ "marginTop": "0px", "height": "800px", "zIndex": -9999, }, children=[ # pylint: disable=no-member webviz_subsurface_components.LeafletMap( id=self.ids("layered-map"), layers=[], unitScale={}, autoScaleMap=True, minZoom=-5, drawTools={ "drawMarker": False, "drawPolygon": False, "drawPolyline": True, "position": "topright", }, switch={ "value": self.state["switch"], "disabled": False, "label": "Hillshading", }, mouseCoords={"position": "bottomright"}, colorBar={"position": "bottomright"}, ), ], ), ] )
# Defining app layout app.layout = html.Div( style={"backgroundColor": colors["background"]}, children=[ html.Div( [ html.H2("Chess App"), html.Img(src="/assets/chess-app.jpg"), ], className="banner", ), html.Div( [ html.Div( [ html.Label("Range Slider"), dcc.RangeSlider( id="rangeslider", marks={ i: "label {}".format(i) for i in range(0, 5) }, min=0, max=5, value=[0, 1], step=1, ), ], className="five columns", ), html.Div(
'textAlign': 'center', 'font-family': 'Dosis', 'font-size': '32x', 'color': colors['text'], 'padding': 0 } ), html.Div(children='A web application for analyzing comments on Youtube videos', style={ 'textAlign': 'center', 'color': colors['subtext'], 'padding': 8 }), html.Label('URL: ', style={ 'font-family': 'Dosis', 'color': colors['text'] }), #dcc.Textarea( # id='my-id', # placeholder='Enter a value...', # value='Enter Youtube video URL here', # style={'height': '8px', # 'width': '800px', # 'textAlign': 'left', 'padding': 8} # ), #dcc.Input(id='my-id', value='initial value', type='text'), dcc.Input(id='video-input', value='Enter Youtube video URL here', type='text', style={'width': '600px'}), html.Div(id='video-input-div'),
def cross_section_widgets_layout(self) -> html.Div: return html.Div( children=[ html.Div( children=[ dbc.Button( "Surface Settings", id=self.ids("button-open-graph-settings"), color="light", className="mr-1", ), dbc.Modal( children=[ dbc.ModalHeader("Surface Settings"), dbc.ModalBody( children=[ html.Label( style={ "font-weight": "bold", "textAlign": "Left", }, children="Select Surfaces", ), dcc.Checklist( id=self.ids("all-surfaces-checkbox"), options=[{"label": "all", "value": "True"}], value=["True"], persistence=True, persistence_type="session", ), dcc.Checklist( id=self.ids("surfaces-checklist"), options=[ {"label": name, "value": name} for name in self.surfacenames ], value=self.surfacenames, persistence=True, persistence_type="session", ), dcc.Checklist( id=self.ids("surfaces-de-checklist"), options=[ { "label": name + " SD", "value": name, "disabled": False, } for name in self.surfacenames ], value=self.surfacenames, persistence=True, persistence_type="session", ), ], ), dbc.ModalFooter( children=[ dbc.Button( "Close", id=self.ids("button-close-graph-settings"), className="ml-auto", ), dbc.Button( "Apply changes", id=self.ids("button-apply-checklist"), className="ml-auto", ), ] ), ], id=self.ids("modal-graph-settings"), size="sm", centered=True, backdrop=False, fade=False, ), dbc.Button( "Well Settings", id=self.ids("button-open-well-settings") ), dbc.Modal( children=[ dbc.ModalHeader("Well Settings"), dbc.ModalBody( children=[ html.Label( style={ "font-weight": "bold", "textAlign": "Left", }, children="Select Well Attributes", ), dcc.Checklist( id=self.ids("all-well-settings-checkbox"), options=[{"label": "all", "value": "True"}], value=["True"], persistence=True, persistence_type="session", ), dcc.Checklist( id=self.ids("well-settings-checklist"), options=[ { "label": "Zonelog", "value": "zonelog", }, { "label": "Zonation points", "value": "zonation_points", }, { "label": "Conditional points", "value": "conditional_points", }, ], value=[ "zonelog", "zonation_points", "conditional_points", ], persistence=True, persistence_type="session", ), ], ), dbc.ModalFooter( children=[ dbc.Button( "Close", id=self.ids("button-close-well-settings"), className="ml-auto", ), dbc.Button( "Apply", id=self.ids( "button-apply-well-settings-checklist" ), className="ml-auto", ), ] ), ], id=self.ids("modal-well-settings"), size="sm", centered=True, backdrop=False, fade=False, ), ], ), wcc.FlexBox( children=[ html.Div( children=[ html.Label( style={ "font-weight": "bold", "textAlign": "center", }, children="Select well", ), dcc.Dropdown( id=self.ids("well-dropdown"), options=[ { "label": self.wells[wf].wellname, "value": str(wf), } for wf in self.wellfiles ] + [ { "label": self.planned_wells[wf].wellname, "value": str(wf), } for wf in self.planned_wellfiles ], value=str(self.wellfiles[0]), clearable=False, disabled=False, persistence=True, persistence_type="session", ), ] ), ], ), html.Div( children=[ html.Div( style={ "marginTop": "0px", "height": "800px", "zIndex": -9999, }, children=[self.cross_section_graph_layout], id=self.ids("cross-section-view"), ) ] ), ] )
def visualize_noisy_affects_filter(): # Parameters seed = 2 data_name = 'MNIST' show_all = False noise_type = 'gaussian_gray' # Save indices if noise_type == 'snp': save_indices = [118, 175] else: save_indices = [333, 1444] # Download MNIST data set set_seed(seed) test_set_n = get_data(data_name, False, noise_type=noise_type, percent_noise=0.1) test_set = get_data(data_name, False) # Create models conv_net = ConvClassificationModel() # Load models conv_net.load( torch.load('models\\pre_trained_models\\mnist_digit_conv.model')) # Pre-compute values raw_results = {} filter_results = {} for i in range(len(test_set)): clean_data, original_label = test_set[i] clean_data_torch = clean_data.view(1, *clean_data.shape).float() clean_label = conv_net.get_label( clean_data_torch).detach().numpy()[0][0] clean_p_dist = np.round(np.exp( conv_net.classify(clean_data_torch).detach().numpy()[0]), decimals=2) clean_data_np = np.flipud(clean_data.detach().numpy()[0, :, :]) noisy_data, _ = test_set_n[i] noisy_data_torch = noisy_data.view(1, *noisy_data.shape).float() noisy_label = conv_net.get_label( noisy_data_torch).detach().numpy()[0][0] noisy_p_dist = np.round(np.exp( conv_net.classify(noisy_data_torch).detach().numpy()[0]), decimals=2) noisy_data_np = np.flipud(noisy_data.detach().numpy()[0, :, :]) label_mismatch = original_label == clean_label and original_label != noisy_label if show_all or label_mismatch: raw_results[i] = (clean_data_np, noisy_data_np, original_label, clean_label, noisy_label, clean_p_dist, noisy_p_dist) filter_results[i] = (get_plots(clean_data_torch, conv_net), get_plots(noisy_data_torch, conv_net)) if i in save_indices: # Dump output filename = 'data\\{}\\noisy_data_np\\{}_{}'.format( data_name, noise_type, i) np.save(filename, noisy_data_np) # Create dash app external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) app.layout = html.Div([ html.Div([ html.Div([ html.Label('Test Set Image Index:'), dcc.Dropdown(id='data_set-index', options=[{ 'label': i, 'value': i } for i in raw_results.keys()], value=list(raw_results.keys())[0]) ], style={ 'width': '33%', 'display': 'inline-block', 'vertical-align': 'top' }), html.Div([ html.Label('Network Layer:'), dcc.Dropdown(id='filter-index', options=[{ 'label': i, 'value': i } for i in [1, 2]], value=2), ], style={ 'width': '33%', 'display': 'inline-block', 'vertical-align': 'top' }), html.Div([ html.Label('Network Layer Type:'), dcc.RadioItems(id='display-type', options=[{ 'label': i, 'value': i } for i in ['Filter', 'Activation']], value='Filter', labelStyle={'display': 'inline-block'}) ], style={ 'width': '33%', 'display': 'inline-block', 'vertical-align': 'top' }) ]), html.Div([ html.Div([ html.Div(id='original-label'), html.Div(id='clean-label'), html.Div(id='noisy-label'), dcc.Graph(id='raw-graph') ], style={ 'width': '35%', 'display': 'inline-block', 'vertical-align': 'top' }), html.Div([dcc.Graph(id='filter-graph')], style={ 'width': '60%', 'display': 'inline-block', 'vertical-align': 'top' }) ]) ]) @app.callback(Output('filter-graph', 'figure'), [ Input('data_set-index', 'value'), Input('display-type', 'value'), Input('filter-index', 'value') ]) def update_graph(selected_index, display_type, filter_index): clean_plot_set, noisy_plot_set = filter_results[selected_index] clean_plots, labels = clean_plot_set[(filter_index, display_type)] noisy_plots, _ = noisy_plot_set[(filter_index, display_type)] num_rows = clean_plots.shape[0] fig = make_subplots( rows=num_rows, cols=3, subplot_titles=[ '{} on {}'.format(t, l) for l in labels for t in ['Clean Image', 'Noisy Image', 'Difference'] ]) for i in range(num_rows): clean_plot = np.flipud(clean_plots[i, :, :]) noisy_plot = np.flipud(noisy_plots[i, :, :]) diff_plot = clean_plot - noisy_plot axis_num = (i * 3) + 1 fig.add_trace(go.Heatmap(z=clean_plot, type='heatmap', coloraxis='coloraxis', showscale=False), row=i + 1, col=1) fig.update_xaxes(showgrid=False, showticklabels=False, zeroline=False, scaleanchor='y{}'.format(axis_num), row=i + 1, col=1) fig.update_yaxes(showgrid=False, showticklabels=False, zeroline=False, row=i + 1, col=1) fig.add_trace(go.Heatmap(z=noisy_plot, type='heatmap', coloraxis='coloraxis', showscale=False), row=i + 1, col=2) fig.update_xaxes(showgrid=False, showticklabels=False, zeroline=False, scaleanchor='y{}'.format(axis_num + 1), row=i + 1, col=2) fig.update_yaxes(showgrid=False, showticklabels=False, zeroline=False, row=i + 1, col=2) fig.add_trace(go.Heatmap(z=diff_plot, type='heatmap', coloraxis='coloraxis', showscale=False), row=i + 1, col=3) fig.update_xaxes(showgrid=False, showticklabels=False, zeroline=False, scaleanchor='y{}'.format(axis_num + 2), row=i + 1, col=3) fig.update_yaxes(showgrid=False, showticklabels=False, zeroline=False, row=i + 1, col=3) fig.update_layout(autosize=False, height=300 * num_rows, coloraxis={'colorscale': 'Gray'}) return fig @app.callback([ Output('raw-graph', 'figure'), Output('original-label', 'children'), Output('clean-label', 'children'), Output('noisy-label', 'children') ], [Input('data_set-index', 'value')]) def update_graph(selected_index): clean_data_np, noisy_data_np, original_label, clean_label, noisy_label, clean_p_dist, noisy_p_dist = raw_results[ selected_index] fig = make_subplots(rows=1, cols=2, horizontal_spacing=0.1, vertical_spacing=0.1, subplot_titles=['Clean Image', 'Noisy Image']) fig.add_trace(go.Heatmap(z=clean_data_np, type='heatmap', coloraxis='coloraxis', showscale=False), row=1, col=1) fig.update_xaxes(showgrid=False, showticklabels=False, zeroline=False, scaleanchor='y1', row=1, col=1) fig.update_yaxes(showgrid=False, showticklabels=False, zeroline=False, row=1, col=1) fig.add_trace(go.Heatmap(z=noisy_data_np, type='heatmap', coloraxis='coloraxis', showscale=False), row=1, col=2) fig.update_xaxes(showgrid=False, showticklabels=False, zeroline=False, scaleanchor='y2', row=1, col=2) fig.update_yaxes(showgrid=False, showticklabels=False, zeroline=False, row=1, col=2) fig.update_layout(autosize=False, coloraxis={ 'colorscale': 'Gray', 'showscale': False }) clean_desc = 'Clean Label: {}, Clean Label Probabilities: {}'.format( clean_label, clean_p_dist) noisy_desc = 'Noisy Label: {}, Noisy Label Probabilities: {}'.format( noisy_label, noisy_p_dist) return fig, 'Original Label: {}'.format( original_label), clean_desc, noisy_desc app.run_server(port=8051, debug=True)
def render_status(): # render content for status tab global cmd_algorithm, cmd_loading, ldc_signal return html.Div( children=[ html.Div( [ html.H1("Microgrid Status", style={ 'marginTop': '5', 'text-align': 'center', 'float': 'center', 'color': 'white' }), ], className='banner', style={ 'width': '100%', 'display': 'inline-block', "backgroundColor": "#18252E", }), html.Div( [ html.Div( [ html.Label('Power limit:', className='column', style={ 'color': 'white', 'display': 'inline-block', 'margin': '3' }), html.Div(id='cmd-loading', children=np.round( float(cmd_loading) / 1000, 3), className='row', style={ 'font-size': 'xx-large', 'color': 'white', 'text-align': 'right', 'display': 'inline-block', 'padding': '9', "position": "relative", }), html.Div(id='cmd-loading-unit', children='kVA', className='row', style={ 'font-size': 'xx-large', 'color': 'white', 'text-align': 'left', 'display': 'inline-block', 'padding': '9', "position": "relative", }), ], className='column', ), html.Div( [ html.Label('Set limit (kVA):', className='column', style={ 'color': 'white', 'display': 'inline-block', 'margin': '3', "position": "relative", }), dcc.Input( id='input-cmd-loading', className='row', value=np.round(float(cmd_loading) / 1000, 3), # converted to kW disabled=False, type='number', min=0, max=30, # converted to kW step=0.10, inputmode='numeric', style={ 'text-align': 'center', 'display': 'inline-block', 'padding': '9', "position": "relative", }), ], className='column', ), html.Div( [ html.Label('LDC Signal:', className='column', style={ 'color': 'white', 'display': 'inline-block', 'margin': '3' }), html.Div(id='cmd-signal', children=ldc_signal, className='row', style={ 'font-size': 'xx-large', 'color': 'white', 'text-align': 'right', 'display': 'inline-block', 'padding': '9', "position": "relative", }), html.Div(id='cmd-signal-unit', children='Hz', className='row', style={ 'font-size': 'xx-large', 'color': 'white', 'text-align': 'left', 'display': 'inline-block', 'padding': '9', "position": "relative", }), ], className='row', ), html.Div( [ html.Label('Algorithm:', className='column', style={ 'color': 'white', 'display': 'inline-block', "position": "relative", }), dcc.RadioItems( id='cmd-algorithm', options=[ { "label": "No LDC", "value": "A0" }, { "label": "Basic LDC", "value": "A1" }, { "label": "Advance LDC", "value": "A2" }, # {"label": "Smart LDC", "value": "A3"}, ], value=cmd_algorithm, className='column', style={ 'color': 'white', 'margin': '3', "position": "relative", }), ], className='row', style={ 'display': 'inline-block', "position": "relative", }), ], className='row s12 m2 l2', # style={'padding':'3', 'float':'left'} style={ "position": "relative", "float": "left", # "border": "1px solid", # "borderColor": "rgba(68,149,209,.9)", "overflow": "hidden", "marginBottom": "2px", "width": "15%" }, ), html.Div( [ html.Div( children=html.Div(id='graphs'), className='row', ), # dcc.Interval(id='graph-update', interval=1.5*1000), ], className='row s12 m8 l8', # style={'padding':'3', 'float':'left'}, style={ "position": "relative", "float": "left", # "border": "1px solid", # "borderColor": "rgba(68,149,209,.9)", # "overflow": "hidden", "marginBottom": "2px", "width": "80%", }, ), # hidden div: holder of data html.Div( [ html.Div(children=html.Div(id='data'), className='row', style={ 'opacity': '1.0', 'display': 'none' }), dcc.Interval(id='data-update', interval=1 * 1000), ], className='row', style={ 'display': 'none', }, ), # hidden update for sending ldc command signal html.Div(children=html.Div(id='command'), style={'display': 'none'}), ], className='row', style={ 'display': 'inline-block', "backgroundColor": "#18252E", "width": "100%" })
def update_range_display(time_val): return [html.Label(time_val)]
) ], className="row", ), html.Div( [ html.H1(children='CCTV Dash Board', ), ], className="row", style={"text-align": "center"}, ), html.Div( className='row', children=[ html.Div([ html.Label('Camera'), dcc.Dropdown( id='Camera', options=[{ 'label': 'Camera 1 - cars', 'value': 'C1' }, { 'label': 'Camera 2 - People', 'value': 'C2' }, { 'label': 'Camera 3 - Total # inside', 'value': 'C3' }, { 'label': 'Real time', 'value': 'R' }],
df = pd.concat(dfs) app.layout = html.Div(children=[ html.H2( children='Relationship between delivery type and neonatal mortality'), dcc.Graph(id='relacao-partos', figure={'data': []}), html.Div(id='grafico-slider', style={ 'width': '60vw', 'margin': '0 auto', 'fontFamily': 'sans-serif', 'textAlign': 'center' }, children=[ html.Label('Year:'), dcc.Slider( id='ano-slider', min=2000, max=2016, marks={i: str(i) for i in range(2000, 2017)}, value=2000, included=False, ), html.Br(), html.Br(), html.Label('Transition delay (ms):'), dcc.Slider( id='transicao-slider', min=0,
explaination = """ # Pie chart India mode of Debt India has changed its policy more towards bilateral commitments than multilateral in the Modi Government. """ side_elements = html.Div( className='column', children=[ html.Div( id='pie-table', className='table-pane', children=[ html.Label('Data'), generate_table( idsdata_[(idsdata_['Country Code'].isin(['IND', 'CHN'])) & (idsdata_['Indicator Code'] == 'DT.NFL.MOTH.CD') & (idsdata_['Year'] <= 2018)], max_rows=np.inf) ]), html.Div( className='text-pane', children=[ dcc.Markdown(explaination) # generate_table(df, np.inf), ]), ]) world_map = dcc.Graph(id='pie-world-map',
def generate_html(): months_ago = util.AddMonths(util.ajd, -3) # Layout layout = html.Div( [ html.H1('Analyse des ventes par produit'), html.Div( [ html.Label('Etudier les ventes entre'), dcc.DatePickerRange( id='date_import_orders', display_format='DD/MM/YY', # start_date par défaut : il y a 3 mois (1er jour du mois) start_date=datetime.date(months_ago.year, months_ago.month, 1), # end_date par défaut : aujourd'hui end_date=util.ajd), html.Button(id='import_button', n_clicks=0, children='Réimporter', style={'margin': '0px 0px 0px 10px'}), dcc.Checklist( id='box_rm', options=[{ 'label': 'Ignorer les commandes des teammates', 'value': 'rm_teammates' }, { 'label': 'Ignorer le product type Frais Livraison', 'value': 'rm_delivery' }], values=['rm_delivery'], style={'margin': '10px 0px 0px 0px'}) ], className='row'), html.Div([ html.Div([ html.Label('Sélection des collections'), html.Div(id='collections_clecklist') ], className='six columns'), html.Div([ html.Label('Choix de la mesure à afficher'), dcc.Dropdown(id='dropdown_variable', clearable=False, options=[{ 'label': 'Ventes HT', 'value': 'sells' }, { 'label': 'Marge brute', 'value': 'margin' }, { 'label': 'Nombre de produits vendus', 'value': 'products_sold' }], value='sells'), dcc.Checklist(id='box_pct', options=[{ 'label': 'Afficher en pourcentages', 'value': 'pct' }], values=[], style={'margin': '10px 0px 0px 0px'}), ], className='two columns'), html.Div([ html.Label('Regrouper les produits par'), dcc.RadioItems(id='radio_level', options=[{ 'label': 'Collections', 'value': 'collections' }, { 'label': 'Product types', 'value': 'product_type' }], value='collections') ], className='two columns'), html.Div([ html.Label('Afficher les résultats par'), dcc.RadioItems(id='radio_duration', options=[{ 'label': 'Jours', 'value': 'day' }, { 'label': 'Semaines', 'value': 'week' }, { 'label': 'Mois', 'value': 'month' }], value='month') ], className='two columns') ], className='row', style={'margin': '10px 0px 0px 0px'}), dcc.Graph(id='graph_sells_evolution'), html.Div(id='table_sells_evolution'), # Divs invisibles qui stockeront les données intermédiaires html.Div(id='df_orders_init_storage', style={'display': 'none'}), html.Div(id='table_evolution_storage', style={'display': 'none'}), html.Div(id='df_orders_storage', style={'display': 'none'}) ], style={'padding-left': '7px'}) return layout
) ]), html.Div( style={'textAlign': "center"}, children=[html.H4(children='Data of News'), generate_table(df_news)]), #html.Div(style={'textAlign': "center"}, # children=[html.H4(children='Data of News'), # generate_table(train1)]), html.Div(children=[ html.H2("Model Evaluations"), html. H6('Please wait a moment after changing the values, and ignore the alerts until the table is updated' ), html.Div(children=[ html.Label('Select Model: '), dcc.Dropdown(id='model', options=[{ 'label': 'Logistic Regression', 'value': 'logistic' }, { 'label': 'Random Forest Classifier', 'value': 'rf' }, { 'label': 'XGBoost Classifier', 'value': 'xgboost' }, { 'label': 'LightGBM Classifier', 'value': 'lightgbm' }], value='lightgbm')
"z-index": 1000, 'display': 'block', "height": "100%", "padding": "2rem 1rem", "background-color": "#f8f9fa" } layout1 = html.Div( className='info', children=[ dbc.Nav( [ # Sidebar Title html.H4("Filter on Districts"), # District_Dropdown html.Label(children=['Stadsdeel: ']), dcc.Dropdown( id='District', options=[{ 'label': b, 'value': b } for b in sorted(df['District'].unique())], value=[b for b in sorted(df['District'].unique())], multi=True), # SubDistrict_Dropdown html.Label(children=['Wijk: ']), dcc.Dropdown(id='SubDistrict', options=[], placeholder='Select a SubDistrict', multi=True), # SubSubDistrict_Dropdown
from pandas import DataFrame, Series import dash import dash_core_components as dcc import dash_html_components as html from dash.dependencies import Input, Output import plotly.graph_objs as go import numpy as np df = pd.read_excel("output.xlsx") #print df["OOM_ADJ.Native"] app = dash.Dash() app.layout = html.Div( [ html.Div([ html.Label("OOM_ADJ_CheckBoxes"), dcc.Checklist(id="OOM_ADJ_Checklist", options=[{ 'label': "OOM_ADJ.Native", 'value': "native" }, { 'label': "OOM_ADJ.Persist", 'value': "persist" }, { 'label': "OOM_ADJ.SystemServer", 'value': "system" }, { 'label': "OOM_ADJ.Foreground", 'value': "foreground" }, { 'label': "OOM_ADJ.Visible",
"https://www.medrxiv.org/content/10.1101/2021.01.15.20248217v1", target="_blank", style={ "color": "#6211FF", "font-size": "20px" })) ]), dbc.Row([ html.Label([ 'Projections on removal of lockdown can be found on this link ---> ', html.A( 'here', href= 'https://sars-covid-tracker-india.herokuapp.com/lockdown', style={ "color": "#E60B1F", 'font-size': '20px' }) ], style={ "color": "#151516", 'font-size': '20px' }) ]), dbc.Row([ html. P("Computing is provided by Chameleon Cloud, sponsored by NSF-USA", style={"font-size": "10px"}) ]), dbc.Row([ html.
globalvars['single_zz'] = single_zz return globalvars globalvars = initialize() external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) server = app.server app.layout = html.Div([ html.H1('AdaBoost Visualized'), html.Div([ html.Div([ html.Label('Tree Depth'), dcc.Dropdown(id='tree-depth-dropdown', options=[{ 'label': '1', 'value': '1' }, { 'label': '2', 'value': '2' }, { 'label': '3', 'value': '3' }], value='2'), ], style={ 'width': '12%',
'Search for a particular security topic to learn about.', className='faded') ], className='header-title') ], className='page-header') ], className='container p-4') ], className='custom-header mb-4 noselect'), html.Div([ html.Div([ html.Div([ html.Label([ 'Date of Start:', dcc.DatePickerSingle(id='date-picker-single1', date=datetime(1997, 5, 10)), ], className='col-sm-4 d-sm-inline-block'), html.Label([ 'Date of End:', dcc.DatePickerSingle( id='date-picker-single2', date=datetime(1997, 5, 10), ), ], className='col-sm-4 d-sm-inline-block'), html.Label([ 'Select a City:', dcc.Dropdown(id='demo-dropdown-central', options=[{ 'label': 'New York City',
app = dash.Dash() beta_slider = daq.Slider(id='beta', value=1.2, min=0, max=4, step=0.01, marks={0: '0', 2: '2', 4: '4'}) gamma_slider = daq.Slider(id='gamma', value=0.2, min=0, max=1, step=0.01, marks={0: '0', 1: '1'}) delta_slider = daq.Slider(id='delta', value=0.2, min=0, max=1, step=0.01, marks={0: '0', 1: '1'}) app.layout = html.Div( children=[dcc.Graph(id='sir-model'), html.Div([ html.Label('Beta'), beta_slider], ),html.Br(), html.Br(), html.Div( [html.Label('Gamma'), gamma_slider]), html.Br(), html.Br(), html.Div( [html.Label('Delta'), delta_slider])] ) @app.callback(Output('sir-model', 'figure'),
ICD9_dx = dill.load(open('op_lib.pkd', 'rb')) external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] server = flask.Flask(__name__) app = dash.Dash(__name__, server=server, external_stylesheets=external_stylesheets) app.config.supress_callback_exceptions=True app.layout = html.Div([ html.H1(children='National Medicare Provider Lookup'), dcc.Location(id='url', refresh=False), html.Div(id='page-content'), html.Div([ html.Label('Who can help me with: '), dcc.Dropdown( options=a, value='V70', multi=False, id='input' ), html.Div(id='output') ]), html.Label('I live in: '), html.Div([ html.Label('City: '), dcc.Dropdown( options=cities_list, value='Oakland',
children=html.Div( ['Drag and Drop or ', html.A('Select Files')]), style={ 'width': '100%', 'height': '60px', 'lineHeight': '60px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', 'margin': '10px' }, multiple=True), html.Div(id='output-data-upload'), html.Label('Subject ID'), dcc.Dropdown(id='subject-id', options=[{ 'label': i, 'value': i } for i in df['patient_id'].values.tolist()]), dcc.RadioItems(id='editing-choice', options=[{ 'label': i, 'value': i } for i in ['Edit SNP', 'Optimize SNP']]), html.Button(id='submit-button', n_clicks=0, children='Submit'), dcc.Graph(id='population-distribution-graph'), html.Div(id='branch') ])
# -*- coding: utf-8 -*- """ Created on Sun Jun 16 19:52:22 2019 @author: reeff """ import dash_html_components as html References=html.Div([ html.Div([ html.H3('Referencias:'), html.Label(['-Indian Diabetic Retinopathy Image Dataset (IDRiD) ', html.A('Link', href='https://ieee-dataport.org/open-access/indian-diabetic-retinopathy-image-dataset-idrid', target='_blank')]), html.H4(''), html.Label(['-Decencière et al.. Feedback on a publicly distributed database: the Messidor database. Image Analysis & Stereology, v. 33, n. 3, p. 231-234, aug. 2014. ISSN 1854-5165. ', html.A('Link 1', href='http://www.ias-iss.org/ojs/IAS/article/view/1155', target='_blank')]), html.Label(['', html.A('Link 2', href='http://dx.doi.org/10.5566/ias.1155', target='_blank')]), html.H4(''), html.Label(['-Kaggle: Diabetic Retinopathy Detection ', html.A('Link', href='https://www.kaggle.com/c/diabetic-retinopathy-detection', target='_blank')]), html.H4(''), html.Label(['-Source Code in GitHub ', html.A('https://fernandoferrer.github.io/ICDR/', href='https://fernandoferrer.github.io/ICDR/', target='_blank')]), ],style = {'background-image':'linear-gradient(to bottom right, rgba(183,183,183,0.7), rgba(111,163,225,0.7))', 'font-size':'medium', 'box-shadow':'5px 1px 10px 1px grey'}, ), ])
'width': '5px', 'color': 'white' }), html.Br(), html.Br(), html.H2("Slicing/Plotting Selectors: "), html.Div( id="dropdown-div", children=[ dbc.Row( id="dropdown-row", children=[ dbc.Col(children=[ html.Label( ['Select harmonic'], style={ 'font-weight': 'bold', "text-align": "left" }), dcc.Dropdown( id="slct_harm", options=[{ 'label': x, 'value': x } for x in harm_list], style={ 'width': '150px', 'vertical-align': "middle", 'color': 'black' }, value='1', multi=False,
def load_main_chart(): return html.Div(children=[ html.Div(children=[ html.H2('Incrementum Store of Value Crypto Index vs Bitcoin') ], className='main-title'), html.Div(children=[ html.Details(id='export-data', children=[ html.Summary('Export Data'), html.Ul(id='export-list', className='filedownload', children=[], style={ 'position': 'absolute', 'display': 'block', 'z-index': 1 }) ], className='export-data-opts'), html.Div(className='frequency-selector m-l-auto', children=[ html.Label('Frequency:'), dcc.Dropdown(id='freq-dropdown-one', options=[ { 'label': 'Daily', 'value': 'Daily' }, { 'label': 'Weekly', 'value': 'Weekly' }, { 'label': 'Monthly', 'value': 'Monthly' }, { 'label': 'Quaterly', 'value': 'Quaterly' }, ], value='Daily'), ]), html.Div(className='quick-filters m-l-auto', children=[ html.Button('YTD', id='button5', n_clicks_timestamp=0, style={'border': 'none'}), html.Span('|'), html.Button('1Y', id='button3', n_clicks_timestamp=0, style={'border': 'none'}), html.Span('|'), html.Button('5Y', id='button2', n_clicks_timestamp=0, style={'border': 'none'}), html.Span('|'), html.Button('10Y', id='button4', n_clicks_timestamp=0, style={'border': 'none'}), html.Span('|'), html.Button('MAX', id='button1', n_clicks_timestamp=0, style={'border': 'none'}), ]), html.Div([ dcc.DatePickerRange( id='date-picker-range-one', start_date=data.index.min(), end_date=data.index.max(), max_date_allowed=data.index.max(), min_date_allowed=data.index.min(), display_format='DD/MM/YYYY', ), ], className='m-l-auto'), ], className='date-and-export'), html.Div([ dcc.Graph( id='store-of-val-index', config={ 'displaylogo': False, 'displayModeBar': True, 'modeBarButtonsToRemove': ['toggleSpikelines', 'hoverCompareCartesian'], }, figure={ 'data': [ go.Scatter( x=data.index, y=data['SOV_index'], mode='lines'), go.Scatter(x=data.index, y=data['Btc_Close_Price'], mode='lines', fillcolor='rgb(24, 128, 56)'), ], 'layout': main_graph_layout }, ) ], style={'margin': 0}), html.Div( id='graph-info', children=[ html.Span('Source:', className='source-title'), html.Span('Coinmarketcap.com, Incrementum AG', className='sources'), html. P('The Incrementum Store of Value Index is a market capitalization \ weighted index comprising of all non-Turing complete cryptocurrencies \ with at least two out of three criteria met including market capitalization \ of $500,000 or higher, market trading for 365 days or greater, and market \ trading on two exchanges or more. Privacy coins are excluded. \ The three coins in the index are Bitcoin, Bitcoin Cash, and Litecoin.', className='source-description'), html.Span('Suggested Citation:', className='citation-title'), html. P('Incrementum AG, Incrementum Store of Value Crypto Index, retrieved \ from Crypto Research Report; http://data.cryptoresearch.report/graph/storeofvalueindex, \ September, 2019.', className='citation-info') ], className='graph-info'), html.Div(children=social_share_links, className='social-links'), ], className='detailed-graph')
def well_points_tab_layout(self) -> html.Div: return html.Div( [ dbc.Button("Table Settings", id=self.ids("button-open-table-settings")), dbc.Modal( children=[ dbc.ModalHeader("Table Settings"), dbc.ModalBody( children=[ html.Label( style={ "font-weight": "bold", "textAlign": "Left", }, children="Select Table Columns", ), dcc.Checklist( id=self.ids("columns-checklist"), options=[ {"label": name, "value": column_name} for name, column_name in zip( self.df_well_target_points.get_wellpoints_df() .keys() .values, self.df_well_target_points.get_wellpoints_df() .keys() .values, ) ], value=[ "Surface", "Well", "TVD", "MD", "Outlier", "Deleted", "Residual", ], persistence=True, persistence_type="session", ), ], ), dbc.ModalFooter( children=[ dbc.Button( "Close", id=self.ids("button-close-table-settings"), className="ml-auto", ), dbc.Button( "Apply", id=self.ids("button-apply-columnlist"), className="ml-auto", ), ] ), ], id=self.ids("modal-table-settings"), size="sm", centered=True, backdrop=False, fade=False, ), html.Div(id=self.ids("well-points-table-container")), ] )
def test_cblp001_radio_buttons_callbacks_generating_children(dash_duo): TIMEOUT = 2 with open(os.path.join(os.path.dirname(__file__), "state_path.json")) as fp: EXPECTED_PATHS = json.load(fp) app = Dash(__name__) app.layout = html.Div([ dcc.RadioItems( options=[ { "label": "Chapter 1", "value": "chapter1" }, { "label": "Chapter 2", "value": "chapter2" }, { "label": "Chapter 3", "value": "chapter3" }, { "label": "Chapter 4", "value": "chapter4" }, { "label": "Chapter 5", "value": "chapter5" }, ], value="chapter1", id="toc", ), html.Div(id="body"), ]) for script in dcc._js_dist: app.scripts.append_script(script) chapters = { "chapter1": html.Div([ html.H1("Chapter 1", id="chapter1-header"), dcc.Dropdown( options=[{ "label": i, "value": i } for i in ["NYC", "MTL", "SF"]], value="NYC", id="chapter1-controls", ), html.Label(id="chapter1-label"), dcc.Graph(id="chapter1-graph"), ]), # Chapter 2 has the some of the same components in the same order # as Chapter 1. This means that they won't get remounted # unless they set their own keys are differently. # Switching back and forth between 1 and 2 implicitly # tests how components update when they aren't remounted. "chapter2": html.Div([ html.H1("Chapter 2", id="chapter2-header"), dcc.RadioItems( options=[{ "label": i, "value": i } for i in ["USA", "Canada"]], value="USA", id="chapter2-controls", ), html.Label(id="chapter2-label"), dcc.Graph(id="chapter2-graph"), ]), # Chapter 3 has a different layout and so the components # should get rewritten "chapter3": [ html.Div( html.Div([ html.H3("Chapter 3", id="chapter3-header"), html.Label(id="chapter3-label"), dcc.Graph(id="chapter3-graph"), dcc.RadioItems( options=[{ "label": i, "value": i } for i in ["Summer", "Winter"]], value="Winter", id="chapter3-controls", ), ])) ], # Chapter 4 doesn't have an object to recursively traverse "chapter4": "Just a string", } call_counts = { "body": Value("i", 0), "chapter1-graph": Value("i", 0), "chapter1-label": Value("i", 0), "chapter2-graph": Value("i", 0), "chapter2-label": Value("i", 0), "chapter3-graph": Value("i", 0), "chapter3-label": Value("i", 0), } @app.callback(Output("body", "children"), [Input("toc", "value")]) def display_chapter(toc_value): call_counts["body"].value += 1 return chapters[toc_value] app.config.suppress_callback_exceptions = True def generate_graph_callback(counterId): def callback(value): call_counts[counterId].value += 1 return { "data": [{ "x": ["Call Counter"], "y": [call_counts[counterId].value], "type": "bar", }], "layout": { "title": value }, } return callback def generate_label_callback(id_): def update_label(value): call_counts[id_].value += 1 return value return update_label for chapter in ["chapter1", "chapter2", "chapter3"]: app.callback( Output("{}-graph".format(chapter), "figure"), [Input("{}-controls".format(chapter), "value")], )(generate_graph_callback("{}-graph".format(chapter))) app.callback( Output("{}-label".format(chapter), "children"), [Input("{}-controls".format(chapter), "value")], )(generate_label_callback("{}-label".format(chapter))) dash_duo.start_server(app) def check_chapter(chapter): dash_duo.wait_for_element( '#{}-graph:not(.dash-graph--pending)'.format(chapter)) for key in dash_duo.redux_state_paths: assert dash_duo.find_elements( "#{}".format(key)), "each element should exist in the dom" value = (chapters[chapter][0]["{}-controls".format(chapter)].value if chapter == "chapter3" else chapters[chapter]["{}-controls".format(chapter)].value) # check the actual values dash_duo.wait_for_text_to_equal("#{}-label".format(chapter), value) wait.until( lambda: (dash_duo.driver.execute_script( "return document." 'querySelector("#{}-graph:not(.dash-graph--pending) .js-plotly-plot").' .format(chapter) + "layout.title.text") == value), TIMEOUT, ) rqs = dash_duo.redux_state_rqs assert rqs, "request queue is not empty" assert all((rq["status"] == 200 and not rq["rejected"] for rq in rqs)) def check_call_counts(chapters, count): for chapter in chapters: assert call_counts[chapter + "-graph"].value == count assert call_counts[chapter + "-label"].value == count wait.until(lambda: call_counts["body"].value == 1, TIMEOUT) wait.until(lambda: call_counts["chapter1-graph"].value == 1, TIMEOUT) wait.until(lambda: call_counts["chapter1-label"].value == 1, TIMEOUT) check_call_counts(("chapter2", "chapter3"), 0) assert dash_duo.redux_state_paths == EXPECTED_PATHS["chapter1"] check_chapter("chapter1") dash_duo.percy_snapshot(name="chapter-1") dash_duo.find_elements('input[type="radio"]')[1].click() # switch chapters wait.until(lambda: call_counts["body"].value == 2, TIMEOUT) wait.until(lambda: call_counts["chapter2-graph"].value == 1, TIMEOUT) wait.until(lambda: call_counts["chapter2-label"].value == 1, TIMEOUT) check_call_counts(("chapter1", ), 1) assert dash_duo.redux_state_paths == EXPECTED_PATHS["chapter2"] check_chapter("chapter2") dash_duo.percy_snapshot(name="chapter-2") # switch to 3 dash_duo.find_elements('input[type="radio"]')[2].click() wait.until(lambda: call_counts["body"].value == 3, TIMEOUT) wait.until(lambda: call_counts["chapter3-graph"].value == 1, TIMEOUT) wait.until(lambda: call_counts["chapter3-label"].value == 1, TIMEOUT) check_call_counts(("chapter2", "chapter1"), 1) assert dash_duo.redux_state_paths == EXPECTED_PATHS["chapter3"] check_chapter("chapter3") dash_duo.percy_snapshot(name="chapter-3") dash_duo.find_elements('input[type="radio"]')[3].click() # switch to 4 dash_duo.wait_for_text_to_equal("#body", "Just a string") dash_duo.percy_snapshot(name="chapter-4") for key in dash_duo.redux_state_paths: assert dash_duo.find_elements( "#{}".format(key)), "each element should exist in the dom" assert dash_duo.redux_state_paths == { "toc": ["props", "children", 0], "body": ["props", "children", 1], } dash_duo.find_elements('input[type="radio"]')[0].click() wait.until( lambda: dash_duo.redux_state_paths == EXPECTED_PATHS["chapter1"], TIMEOUT, ) check_chapter("chapter1") dash_duo.percy_snapshot(name="chapter-1-again")
import dash_bootstrap_components as dbc import pandas as pd import plotly.express as px df = pd.read_csv('politics.csv') app = dash.Dash(__name__, external_stylesheets=[dbc.themes.BOOTSTRAP]) server = app.server # radioItem list for the layout (long_code.py lines 13-45) radio_list = [] for s,v in zip(['AZ','FL','GA','IA','ME','MI','NC','NV','OH','PA','TX','WI'], [11,29,16,6,4,16,15,6,18,20,38,10]): radio_list.append( html.Div([ html.Label(f'{s}-{v}: ', style={'display':'inline', 'fontSize':15}), dcc.RadioItems( id=f'radiolist-{s}', options=[ {"label": "Dem", "value": "democrat"}, {"label": "Rep", "value": "republican"}, {"label": "NA", "value": "unsure"}, ], value='unsure', inputStyle={'margin-left': '10px'}, labelStyle={'display': 'inline-block'}, style={'display':'inline'} ), ], style={'textAlign':'end'}) ) print(radio_list)
''' app.layout = html.Div([ html.H1('DATA 608 : Final Project', style={ 'backgroundColor': 'black', 'color': 'white' }), html.H3('Jose A. Mawyin', style={ 'backgroundColor': 'grey', 'color': 'white' }), dcc.Markdown(children=intro), dcc.Markdown(children=markdown_text1), html.Label('Select an Acorn Group to Populate Graph: '), dcc.Dropdown(id='dropdown1', options=[{ 'label': i, 'value': i } for i in Average_Hour_Day.Acorn_group.unique()], multi=False, placeholder='Filter by boroname...'), html.Div(id='Bar1'), html.Div(style={'textAlign': 'center'}, children=''' Jose A. Mawyin 2020. ''') ], style={ 'width': '100%', 'padding-left': '15%', 'padding-right': '15%'
mode='lines+markers', name=query_date + " " + source + " - [km/h]", xaxis="x1", yaxis="y2") return trace_y1, trace_y2 app = dash.Dash('Travel Times') mapbox_access_token = tokens.get_mapbox_token() app.layout = html.Div([ # This component generates a <h1></h1> HTML element in your application html.H1('Tiempos de viaje'), # The dcc describe higher-level components that are interactive html.Label('Selecciona la ruta'), dcc.Dropdown( id='query-routes', options=[{ 'label': i, 'value': i } for i in df_tt_w['name'].unique()], # This is the default value value=df_tt_w.iloc[0, 0] #This is a string, ok! ), html.Label('Selecciona la fecha'), dcc.Dropdown(id='query-dates', options=[{ 'label': i.strftime("%d-%m-%Y"), 'value': i } for i in df_tt_w['date'].unique()],
import dash import dash_core_components as dcc import dash_html_components as html external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] app = dash.Dash(__name__, external_stylesheets=external_stylesheets) app.layout = html.Div([ html.Label('Dropdown'), dcc.Dropdown( options=[ {'label': '佐藤', 'value': 'sato'}, {'label': '鈴木', 'value': 'suzuki'}, {'label': '石川', 'value': 'ishikawa'}, ], value='suzuki' ), html.Label('Multi-Select Dropdown'), dcc.Dropdown( options=[ {'label': '佐藤', 'value': 'sato'}, {'label': '鈴木', 'value': 'suzuki'}, {'label': '田中', 'value': 'tanaka'}, ], value=['sato','suzuki'], multi=True ),