html.Br(), # Sub-title Left html.Div([dcc.Markdown(children=markdown_text1)], style={ 'width': '80%', 'display': 'inline-block', "font-size": "20px" }), # Space between text and dropdown html.H1(id='space1', children=' '), # Dropdown html.Div([ dcc.Textarea( id="question-input", value= "I just want to create a simple C++ struct that has an int index and an int gray value . The function is given the vector with the gray values. When I try to compile it I get a segmentation fault, does ...", style={ 'width': '100%', 'height': 300 }) ], style={ 'width': '40%', 'display': 'inline-block' }), # # Space between dropdown AND POST # html.H1(id='space2', children=' '), # html.Div(id='post-text', children= "Fetching question from "+default_site+"... (Please wait 5-10 seconds) :)", # style={'whiteSpace': 'pre-line', "font-style": "italic"}), # Space between text and CATEGORY PREDICTED html.H1(id='space3', children=' '), html.H1(id='space4', children=' '),
html.P('Import data from:'), dcc.Input(id='in-path-input', type='text', value=in_path, style={'min-width': '35em'}), html.Button('Load', id='in-path-button', n_clicks_timestamp=0, style={ 'margin-top': '10pt', 'display': 'block' }), dcc.Textarea(id='loaded-files-area', readOnly=True, value='\n'.join(loaded_files), style={ 'min-width': '35em', 'display': 'block', 'margin-top': '10pt' }), ], style={ 'padding': '10pt', 'display': 'inline-block', 'vertical-align': 'top' }), html.Div( [ html.P('Export current view to:'), dcc.Input(id='export-input', type='text', value=in_path,
def get_dashboard_app(server=None): session = boto3.session.Session( aws_access_key_id=AWS_ACCESS_KEY_ID, aws_secret_access_key=AWS_SECRET_ACCESS_KEY ) if not LOCAL: logger.info('Attempting to download DB from S3..') try: if not os.path.exists(f"{DB_DIR}"): download_from_s3(local_path=f"{DB_DIR}", s3_path='db.sqlite', bucket=S3_BUCKET_NAME) except Exception as e: raise Exception(f'DB cannot be found in S3, or the access credentials are incorrect. Error: {e}') # Download training data from S3 logger.info('Downloading training data from S3') files = wr.s3.list_objects(f's3://{S3_BUCKET_NAME}/training_data/', boto3_session=session) for file in files: filename = file.split(f's3://{S3_BUCKET_NAME}/training_data/')[1] download_from_s3(local_path=f'{training_data_dir}/{filename}', s3_path=f'training_data/{filename}', bucket=S3_BUCKET_NAME) # Download models from S3 logger.info('Downloading models from S3') files = wr.s3.list_objects(f's3://{S3_BUCKET_NAME}/models/', boto3_session=session) files = [f for f in files if 'in_production' not in f] for file in files: filename = file.split(f's3://{S3_BUCKET_NAME}/models/')[1] download_from_s3(local_path=f'{model_dir}/{filename}', s3_path=f'models/{filename}', bucket=S3_BUCKET_NAME) # Get the latest predictions latest_preds = run_query(query='select * from latest_predictions') # Get the names of models saved in the models directory model_names = os.listdir(model_dir) model_names = [m for m in model_names if '.joblib' in m] if len(model_names) < 1: raise Exception('No models could be found to add to the dashboard') predictions = run_query(query='select * from historic_predictions') logger.info(f'Retrieved {len(predictions)} rows from the historic_predictions table') # Get historic features historic_df_all, all_model_ids = get_historic_features(predictions, model_names) logger.info(f"Found {len(all_model_ids)} models in the DB") # Drop Duplicates historic_df_all = historic_df_all.drop_duplicates() logger.info(f'Retrieved historic features. Rows: {len(historic_df_all)}') # Load the in-production model production_model, production_model_id, production_model_dir = load_production_model() # Get the current season current_season = run_query(query='select max(season) from main_fixtures').iloc[0, 0] # Get the historic predictions for the production model historic_df = historic_df_all[historic_df_all['model_id'] == production_model_id] # Save latest_preds and all_model_ids to the /tmp file. We will use these to # determine whether the dashboard has been updated joblib.dump(latest_preds, f"{tmp_dir}/latest_preds.joblib") joblib.dump(model_names, f"{tmp_dir}/model_names.joblib") # Get the performance of the model for each team, at home and away combined_team_perf = get_team_home_away_performance(historic_df=historic_df, current_season=current_season) logger.info(f'Getting team performance at home and away, returned {len(combined_team_perf)} rows') # Get the performance of all models, grouped by season time_perf = get_performance_by_season( historic_df_all=historic_df_all, production_model_id=production_model_id) # Get the cumulative profit gained form each model over time profit_perf = get_cumulative_profit_view( historic_df_all=historic_df_all, all_model_ids=all_model_ids, production_model_id=production_model_id) # Get the cumulative profit from betting on the favourite profit_perf_bof = get_cumulative_profit_from_bof(historic_df=historic_df) logger.info(f'Getting cumulative profit from betting on the favourite, returned {len(profit_perf_bof)} rows') # Get the performance of each model, grouped by the difference in form between teams form_diff_acc = get_form_dif_view(historic_df_all=historic_df_all, production_model_id=production_model_id) logger.info(f'Getting performance of each model grouped by difference in form, returned {len(form_diff_acc)} rows') if server is not None: logger.info(f'Server passed of type {str(type(server))}. It will only be used if its of type Flask.') # Create the dashboard app = dash.Dash(__name__, # Use the server if its a Flask object, else create our own server=server if isinstance(server, Flask) else True, external_stylesheets=[dbc.themes.BOOTSTRAP], url_base_pathname='/dashboard/') app.config.suppress_callback_exceptions = True # Show the latest predictions (if any exist) if len(latest_preds) > 0: upcoming_fixture_table = dash_table.DataTable( id='next_fixtures', columns=[{"name": i, "id": i} for i in latest_preds.columns], data=latest_preds.to_dict('records')) else: upcoming_fixture_table = html.P('No upcoming fixtures available. Was there a pandemic recently?') # Define the app layout app.layout = html.Div( children=[ dbc.Row([ dbc.Col([ html.H2("Upcoming Fixtures"), upcoming_fixture_table, ]) ]), dbc.Row([ dbc.Col([ html.H4("Model Performance Plots"), html.P("The following sections show the performance of the model, split into different views. " "These views allow us to see where the model is underperforming, so that we can " "design new features to help mitigate its shortcomings.") ]) ]), dbc.Row([ dbc.Col([ html.H4("Profit Over Time (Cumulative Sum)"), html.P("This section shows the cumulative profit by date of the different " "models. We use 10-fold cross-validation to train the model, saving the " "predictions in each fold. Because of this, we have predictions for 100% " "of the data which is very useful for analysing model performance" "when you don't have much data."), dcc.Graph( id='profit_by_date', figure={ 'data': [ go.Scatter( x=profit_perf[profit_perf['Model ID'] == model_id]['Date'], y=profit_perf[profit_perf['Model ID'] == model_id]['Profit'], mode="lines+markers", name='_'.join(model_id.split('_')[:-1]), ) for model_id in all_model_ids] + [go.Scatter( x=profit_perf_bof['Date'], y=profit_perf_bof['Profit'], mode="lines+markers", name='Betting on Favourite' )], 'layout': go.Layout( title="Profit Over Time (Cumulative Sum)", clickmode='event+select', height=600, ) })], width=12) ]), dbc.Row([ dbc.Col([ html.H4("Model Accuracy for PL Teams - Home and Away"), html.P("Below you can see the accuracy of the model at predicting " "for each team, split by whether the team was at home or away. " "Future strategies may involve only betting on teams that the " "model has a good accuracy with. The accuracy of the model is " "mainly down to the consistency of results for the team."), dcc.Graph( id='accuracy_home_away', figure={ 'data': [ {'x': combined_team_perf['Team Name'], 'y': combined_team_perf['Accuracy when Home'], 'type': 'bar', 'name': 'Home'}, {'x': combined_team_perf['Team Name'], 'y': combined_team_perf['Accuracy when Away'], 'type': 'bar', 'name': 'Away'} ], 'layout': { 'title': 'Model Accuracy for PL Teams - Home and Away' } } ) ], width=12) ]), dbc.Row( dbc.Col([ html.H4("Model Accuracy Over Time"), html.P("Below you can see the accuracy of each model over time. Notice how " "the model under-performs in certain seasons. The outlier is the year " "Leicester won the league."), dcc.Graph( id='accuracy_over_time', figure={ 'data': [ go.Scatter( x=time_perf[time_perf['Model ID'] == model_id].sort_values('Date')['Date'], y=time_perf[time_perf['Model ID'] == model_id].sort_values('Date')['Accuracy'], mode="lines+markers", name='_'.join(model_id.split('_')[:-1]) ) for model_id in all_model_ids], 'layout': go.Layout( title="Model Accuracy Over Time", clickmode='event+select', height=600, ) })], width=12) ), dbc.Row( dbc.Col([ html.H4("Accuracy vs Form Difference"), html.P("This figure shows the performance of the model, split by the " "average goal difference of the opponents in the last 8 games. " "The more difficult matchups are when the teams have similar performance. " "We can also see the effect of the home advantage here."), dcc.Graph( id='form_diff_acc', figure={ 'data': [ go.Scatter( x=form_diff_acc[form_diff_acc['Model ID'] == model_id].sort_values('Form Dif')['Form Dif'], y=form_diff_acc[form_diff_acc['Model ID'] == model_id].sort_values('Form Dif')['Correct'], mode="lines+markers", name='_'.join(model_id.split('_')[:-1]) ) for model_id in all_model_ids], 'layout': go.Layout( title="Accuracy vs Form Difference (home_goal_dif_last_7 - " "away_goal_dif_last_7)", clickmode='event+select', height=600, ) })], width=12) ), dbc.Row( dbc.Col([ dcc.Interval( id='interval-component', interval=1 * 1000 * 60, # in milliseconds, run every minute n_intervals=0 ), dcc.Textarea(id='update')] ) ) ] ) @app.callback(Output('update', 'value'), [Input('interval-component', 'n_intervals')]) def check_for_updates(interval): # ToDo: Why isnt this updating properly # Get the names of models saved in the models directory model_names = os.listdir(model_dir) model_names = [m for m in model_names if '.joblib' in m] latest_preds = run_query(query='select * from latest_predictions') model_names_local = joblib.load(f"{tmp_dir}/model_names.joblib") latest_preds_local = joblib.load(f"{tmp_dir}/latest_preds.joblib") # If there are any updates, save a file for each active graph, which will tell the dashboard to update if not model_names.sort() == model_names_local.sort() or not latest_preds.equals(latest_preds_local): logger.info('Updates to the tables have been detected, updating graphs...') for graph in active_graphs: joblib.dump(1, f"{tmp_dir}/{graph}.joblib") # Save the new values joblib.dump(latest_preds, f"{tmp_dir}/latest_preds.joblib") joblib.dump(model_names, f"{tmp_dir}/model_names.joblib") @app.callback(Output('profit-by-date', 'figure'), [Input('interval-component', 'n_intervals')]) def update_pbd(interval): if os.path.exists(f"{tmp_dir}/profit-by-date.joblib"): logger.info('Updating profit_by_date graph.') # Get the names of models saved in the models directory model_names = os.listdir(model_dir) predictions = run_query(query='select * from historic_predictions') # Get historic features historic_df_all, all_model_ids = get_historic_features(predictions, model_names) # Load the in-production model production_model_dir = os.path.join(model_dir, 'in_production') production_model = os.listdir(production_model_dir) if len(production_model) > 0: logger.warning('There are two models in the in_production folder.. Picking the first one.') production_model_dir = os.path.join(production_model_dir, production_model[0]) logger.info(f'Loading production model from {production_model_dir}') with open(production_model_dir, 'rb') as f_in: production_model = joblib.load(f_in) # Get the ID of the production model production_model_id = production_model.model_id # Get the historic predictions for the production model historic_df = historic_df_all[historic_df_all['model_id'] == production_model_id] # Get the cumulative profit gained form each model over time profit_perf = get_cumulative_profit_view(historic_df_all=historic_df_all, all_model_ids=all_model_ids) # Get the cumulative profit from betting on the favourite profit_perf_bof = get_cumulative_profit_from_bof(historic_df=historic_df) os.remove(f"{tmp_dir}/profit-by-date.joblib") return { 'data': [ go.Scatter( x=profit_perf[profit_perf['Model ID'] == model_id]['Date'], y=profit_perf[profit_perf['Model ID'] == model_id]['Profit'], mode="lines+markers", name='_'.join(model_id.split('_')[:-1]), ) for model_id in all_model_ids] + [go.Scatter( x=profit_perf_bof['Date'], y=profit_perf_bof['Profit'], mode="lines+markers", name='Betting on Favourite' )], 'layout': go.Layout( title="Profit Over Time (Cumulative Sum)", clickmode='event+select', height=600, ) } @app.callback(Output('accuracy_home_away', 'figure'), [Input('interval-component', 'n_intervals')]) def update_aha(interval): if os.path.exists(f"{tmp_dir}/accuracy_home_away.joblib"): logger.info('Updating accuracy_home_away graph.') # Get the names of models saved in the models directory model_names = os.listdir(model_dir) predictions = run_query(query='select * from historic_predictions') # Get historic features historic_df_all, all_model_ids = get_historic_features(predictions, model_names) # Load the in-production model production_model_dir = os.path.join(model_dir, 'in_production') production_model = os.listdir(production_model_dir) if len(production_model) > 0: logger.warning('There are two models in the in_production folder.. Picking the first one.') production_model_dir = os.path.join(production_model_dir, production_model[0]) logger.info(f'Loading production model from {production_model_dir}') with open(production_model_dir, 'rb') as f_in: production_model = joblib.load(f_in) # Get the ID of the production model production_model_id = production_model.model_id # Get the production model features historic_df = historic_df_all[historic_df_all['model_id'] == production_model_id] # Get the performance of the model for each team, at home and away combined_team_perf = get_team_home_away_performance(historic_df=historic_df, current_season=current_season) os.remove(f"{tmp_dir}/accuracy_home_away.joblib") return { 'data': [ {'x': combined_team_perf['Team Name'], 'y': combined_team_perf['Accuracy when Home'], 'type': 'bar', 'name': 'Home'}, {'x': combined_team_perf['Team Name'], 'y': combined_team_perf['Accuracy when Away'], 'type': 'bar', 'name': 'Away'} ], 'layout': { 'title': 'Model Accuracy for PL Teams - Home and Away' } } @app.callback(Output('accuracy_over_time', 'figure'), [Input('interval-component', 'n_intervals')]) def update_aot(interval): if os.path.exists(f"{tmp_dir}/accuracy_over_time.joblib"): logger.info('Updating accuracy_over_time graph.') # Get the names of models saved in the models directory model_names = os.listdir(model_dir) predictions = run_query(query='select * from historic_predictions') # Get historic features historic_df_all, all_model_ids = get_historic_features(predictions, model_names) # Load the in-production model production_model_dir = os.path.join(model_dir, 'in_production') production_model = os.listdir(production_model_dir) if len(production_model) > 0: logger.warning('There are two models in the in_production folder.. Picking the first one.') production_model_dir = os.path.join(production_model_dir, production_model[0]) logger.info(f'Loading production model from {production_model_dir}') with open(production_model_dir, 'rb') as f_in: production_model = joblib.load(f_in) # Get the ID of the production model production_model_id = production_model.model_id # Get the performance of all models, grouped by season time_perf = get_performance_by_season( historic_df_all=historic_df_all, production_model_id=production_model_id) os.remove(f"{tmp_dir}/accuracy_over_time.joblib") return { 'data': [ go.Scatter( x=time_perf[time_perf['Model ID'] == model_id].sort_values('Date')['Date'], y=time_perf[time_perf['Model ID'] == model_id].sort_values('Date')['Accuracy'], mode="lines+markers", name='_'.join(model_id.split('_')[:-1]) ) for model_id in all_model_ids], 'layout': go.Layout( title="Model Accuracy Over Time", clickmode='event+select', height=600, ) } @app.callback(Output('form_dif_acc', 'figure'), [Input('interval-component', 'n_intervals')]) def update_fda(interval): if os.path.exists(f"{tmp_dir}/form_dif_acc.joblib"): logger.info('Updating form_dif_acc graph.') # Get the names of models saved in the models directory model_names = os.listdir(model_dir) predictions = run_query(query='select * from historic_predictions') # Get historic features historic_df_all, all_model_ids = get_historic_features(predictions, model_names) # Load the in-production model production_model_dir = os.path.join(model_dir, 'in_production') production_model = os.listdir(production_model_dir) if len(production_model) > 0: logger.warning('There are two models in the in_production folder.. Picking the first one.') production_model_dir = os.path.join(production_model_dir, production_model[0]) logger.info(f'Loading production model from {production_model_dir}') with open(production_model_dir, 'rb') as f_in: production_model = joblib.load(f_in) # Get the ID of the production model production_model_id = production_model.model_id # Get the performance of each model, grouped by the difference in form between teams form_diff_acc = get_form_dif_view( historic_df_all=historic_df_all, production_model_id=production_model_id) os.remove(f"{tmp_dir}/form_dif_acc.joblib") return { 'data': [ go.Scatter( x=form_diff_acc[form_diff_acc['Model ID'] == model_id].sort_values('Form Dif')['Form Dif'], y=form_diff_acc[form_diff_acc['Model ID'] == model_id].sort_values('Form Dif')['Correct'], mode="lines+markers", name='_'.join(model_id.split('_')[:-1]) ) for model_id in all_model_ids], 'layout': go.Layout( title="Accuracy vs Form Difference (home_goal_dif_last_7 - " "away_goal_dif_last_7)", clickmode='event+select', height=600, ) } # Return the ft_api return app
ComponentBlock('''import dash_core_components as dcc dcc.Input( placeholder='Enter a value...', type='text', value='' )''', style=styles.code_container), html.Br(), dcc.Link('More Input Examples and Reference', href=tools.relpath("/dash-core-components/input")), html.Hr(), html.H3( dcc.Link('Textarea', href=tools.relpath('/dash-core-components/textarea'))), ComponentBlock('''import dash_core_components as dcc dcc.Textarea( placeholder='Enter a value...', value='This is a TextArea component', style={'width': '100%'} )''', style=styles.code_container), html.Br(), html.Br(), dcc.Link('Textarea Reference', href=tools.relpath("/dash-core-components/textarea")), html.Hr(), html.H3( dcc.Link('Checkboxes', href=tools.relpath('/dash-core-components/checklist'))),
style={ "height": "350px", "width": "400px", "position": "absolute", "border": "1px solid #2a3f5f", "border-radius": "5px", }, ), html.Div([ dcc.Textarea( id="object-detection", placeholder="", value=" ", style={ "width": "93%", "height": "291px", "border": "1px solid #2a3f5f", "border-radius": "5px", "position": "absolute", "top": "363px", }, ) ]), ], className="five columns", style={"position": "relative"}, ), ], className="row", style={"marginTop": "4%"}, ),
server = app.server navbar = dbc.NavbarSimple( children=[ dbc.NavItem(dbc.NavLink("Source", href="https://github.com/neshitov/response")), ], brand="Disaster Response Project", brand_href="#", sticky="top", ) app.layout = html.Div(children=[ navbar, dcc.Textarea(placeholder='Enter a message to classify', style={'width': '100%'}, value='', id='input-field'), html.Button('Submit', id='button'), html.Div( id = 'list', children = [] ), html.H3(children='Dataset visualization:', style={'text-align':'center'}), dbc.Container([ dbc.Row([ dbc.Col(html.Img(src=app.get_asset_url('white_cloud.png'))), dbc.Col( dcc.Graph( id='example-graph',
import dash_core_components as dcc import dash_html_components as html import plotly.express as px from dash.dependencies import Input, Output, State import json from app import app gapminder = px.data.gapminder() gap_jp = gapminder[gapminder["country"] == "Japan"] handson1 = html.Div([dcc.Textarea(id="textarea"), html.H1(id="text_output")], style={"margin": "5%"}) @app.callback(Output("text_output", "children"), [Input("textarea", "value")]) def update_text1(textarea_value): return textarea_value handson2 = html.Div( [ dcc.Textarea(id="textarea2", style={ "height": 300, "width": 800 }), html.Button(id="my_button2", n_clicks=0, children="おす"), html.H1(id="text_output2"), ], style={"margin": "5%"},
import dash_html_components as html import webbrowser app = dash.Dash(__name__) port = 5000 # or simply open on the default `8050` port # app = dash.Dash() server = flask.Flask(__name__) # app = dash.Dash(__name__,server=server) app.layout = html.Div(children=[ html.H1(children='Test cases', className="banner"), html.Iframe(id="storyIFrame", # src='static/Inferno.html', className="webpageFrame"), html.Button("press here", id="button"), dcc.Textarea(id="textDiv"), html.Div(children=[html.A('display new page', href='/static/Inferno.html', target='_blank')]) ]) @app.callback([Output("storyIFrame", "src"), Output('textDiv', 'value')], [Input("button", "n_clicks")] ) def on_Button_Click(n_clicks): if n_clicks is None: return '','' print('=== button clicked') # pdb.set_trace() open_tab("file:///Users/David/OpenSource/github/slexil/Dash_Tests/static/Inferno.html") webbrowser.open("static/Inferno.html")
html.Br(), html.Span("Copy text ", className="uppercase bold"), html.Span("directly into the text area box."), ]) ], className="app__header", ), # Textarea box for entering url for text extraction html.Div( [ dcc.Textarea( id='textarea-url', value='https://en.wikipedia.org/wiki/Kubernetes', style={ 'width': '50%', 'height': 100 }, ), #html.Div(id='textarea-url-output', style={'whiteSpace': 'pre-line'}) ], className="app__url_enter_box", ), html.Div( [ html.Button('Extract', id='textarea-url-button', n_clicks=0, style={ 'width': '12%',
db.session.commit() ########### Set up the layout # generates HTML code app.layout = html.Div(children=[ html.H1('Medicinal Cultivar Recommendations'), # multi line single-Div html.Div([ # sections have similar code but unique slider id # header html. H6('Enter a description of your preferences and requested medicinal effects below, and get recommendations from Over 2,300 cultivars.' ), dcc.Textarea( id='textarea', placeholder= 'Please describe your treatment needs here & wait for new results...', value='', style={'width': '100%'}), #added linebreak so no overlap on screen html.Br(), # header # where output data will go html.H6(id='output-message', children='output will go here') ]), html.Br(), html.Br(), html.A('Inspect and Get The Open Source Code On Github', href='https://github.com/lineality/medflask1v1'), html.H6('''For best results, please use terms like the following: (Effect Terms) Aroused
data.columns = ['X', 'Y', 'Cluster', 'paper'] #data = pd.DataFrame(np.random.randn(20, 2), columns = ['X', 'Y']) #print([*['real']*15, *['fake']*5]) #data['paper'] = [*['real']*15, *['fake']*5] app.layout = html.Div([ html.Div( [ #Header html.H3('Fake paper predictor'), #Input boxes html.Label('Input paper title'), dcc.Textarea( id='input_title', placeholder='Enter a paper title', #type='text', value='hello', style={'width': '100%'}), html.Label('Input paper abstract'), dcc.Textarea( id='input_abstract', placeholder='Enter a the paper abstract', #type='text', value='hello', style={'width': '100%'}), #Slider to html.Label('N similar papers'), dcc.Slider(id='npaper', min=1, max=10,
'value': i, 'label': i } for i in df.index], multi=False, ), html.Div(id='most-similar'), html.Br(), html.Hr(), html.H5('What do you want to know?'), html.Div( 'Returns suggestions from the disclosure log. Based on cosine similarity of vectors of submitted text vs requests. These sentence/document vectors are a TF-IDF weighted average of the vectors of the constituent words.' ), html.Br(), dcc.Textarea( id='search-textarea', placeholder='Your request...', rows=50, style={'width': '50%'}, ), html.Br(), html.Button('Submit', id='search_log_button'), html.Br(), html.Div(id='results-list'), html.Br(), html.Br(), html.Hr(), ] app.layout = html.Div(children=layout_children) @app.callback(
from dash.dependencies import Input, Output, State from sklearn.externals import joblib model = joblib.load('modelv1.pkl') app = dash.Dash() server = app.server app.layout = html.Div([ html.H2(children= "Hello :D! Let's see if you are saying something nice or mean..."), html.Div([ html.H3(children="Enter your thoughts:"), dcc.Textarea(id='input-text-area', placeholder="I feel...", style={ 'width': '50%', 'height': '100%' }), html.Br(), html.Div([ html.Button(id='submit-button', n_clicks=0, children='Press me and let me guess', style={ 'font-size': '14px', 'marginLeft': 10 }), html.A(children=html.Button(children='Source in GitHub', style={ 'font-size': '14px', 'marginLeft': 10
def corner_modeling(): with open("./assets/templates/sp_lib", mode="r") as f: buffer_lib = f.read() return html.Div([ html.H5("Selected Modeling"), dbc.Row([ dbc.Col( dcc.Textarea( id="buffer-textarea", value=buffer_lib, style={ "width": "100%", "height": 500 }, )), ]), dbc.Row( [ dbc.Col(dbc.Label("VTH"), width=1), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon("TT", addon_type="prepend"), dbc.Input(id="target-tt-vth", value=0.27), ], ), dbc.InputGroup([ dbc.InputGroupAddon("SS", addon_type="prepend"), dbc.Input(id="target-ss-vth"), ], ), dbc.InputGroup([ dbc.InputGroupAddon("FF", addon_type="prepend"), dbc.Input(id="target-ff-vth"), ], ), ]), dbc.Col(dbc.Label("Ion"), width=1), dbc.Col([ dbc.InputGroup([ dbc.InputGroupAddon("TT", addon_type="prepend"), dbc.Input(id="target-tt-ion", value=8.36), ], ), dbc.InputGroup([ dbc.InputGroupAddon("SS", addon_type="prepend"), dbc.Input(id="target-ss-ion"), ], ), dbc.InputGroup([ dbc.InputGroupAddon("FF", addon_type="prepend"), dbc.Input(id="target-ff-ion"), ], ), ]), dbc.Col([ dbc.Button("Fit Corner", id="fit-button", className="mr-2"), ]), ], className="m-1", ), dbc.Row([ dbc.Col([ dcc.Textarea(id="corner-output", value="library", style={ "width": "100%", "height": 100 }, loading_state={'is_loading': True}), ]), ]), dbc.Button("Apply to Library", color="primary", id="library-bnt", block=True) ])
'value': 'linear' }, { 'label': 'logarithmic', 'value': 'log' }], value='linear', inputStyle={ 'margin-left': '5px', 'margin-right': '5px' }) ]), html.Hr(), html.P('Stock index tickers:'), dcc.Textarea(id='txtr-index-tickers', value='\n'.join(default_index_tickers), style={ 'height': '12rem', 'width': '12rem' }), html.P('Commodity tickers:'), dcc.Textarea( id='txtr-commodity-tickers', value='\n'.join(default_commodity_tickers), style={ 'height': '12rem', 'width': '12rem' }) ], style={'padding': '1rem'}) ]), # body dbc.Col(
def _sub_layouts(self): self.favorite_button = Button( [Icon(kind="heart", fill="r"), html.Span("Favorite")], kind="white", id=self.id("favorite-button"), ) self.favorited_button = Button( [Icon(kind="heart", fill="s"), html.Span("Favorited")], kind="danger", id=self.id("favorite-button"), ) favorite_button_container = html.Div( [self.favorite_button], id=self.id("favorite-button-container"), style={"display": "inline-block"}, ) favorite_materials = html.Div( [ Reveal( [self._make_links([])], title=H6( "Favorited Materials", style={ "display": "inline-block", "vertical-align": "middle" }, ), id=self.id("favorite-materials"), open=True, ) ], id=self.id("favorite-materials-container"), style={"display": "none"}, ) # TODO: add when Dash supports text areas! notes_layout = Reveal( [ Field([ Control( dcc.Textarea( id=self.id("favorite-notes"), className="textarea", rows=6, style={ "height": "100%", "width": "100%" }, placeholder= "Enter your notes on the current material here", )), html.P( [ dcc.Markdown( "Favorites and notes are saved in your web browser " "and not associated with your Materials Project account or stored on our servers. " "If you want a permanent copy, [click here to download all of your notes]()." ) ], className="help", ), ]) ], title="Notes", ) return { "button": favorite_button_container, "favorite_materials": favorite_materials, "notes": notes_layout, }
def get_page_apartments(): df = dss.apartment_summary.df fields = data.get_apartment_key_fields() fields += [ 'growth_rate', 'min_count', 'max_count', 'initial_condition', 'n' ] fields += df.filter(regex='^tz_count_.*').columns.tolist() # TODO: Apply filters on first_count and elapsed_hours_min return [ html.Div(id='table-info-apartments', style={'float': 'right'}), html.Details([ html.Summary('Apartment Data', style={'font-size': '18'}), html.Div([ dcc.Markdown( 'Each row of this table corresponds to an individual apartment (for {} total apartments ' 'across all experimental conditions) and includes the estimated growth rate of cells within' 'that apartment as well as a few other statistics useful for sorting/filtering.' '\n\n**Field Definitions**\n' '- {}: Experimental conditions\n' '- **growth_rate**: 24hr growth rate estimate (log 2)\n' '- **min_count**: Minimum cell count across all images taken' ' (cell type/component set in analysis configuration)\n' '- **max_count**: Maximum cell count across all images taken' ' (cell type/component set in analysis configuration)\n' '- **initial_condition**: String name associated with classification of time zero' ' conditions within apartment (e.g. single_cell, no_cell, double_cell, many_cells)\n' '- **tz_count_\*_\***: Time zero counts for each cell type and component\n' '- **n**: Number of time points (i.e. hours) for which measurements exist for apartment' .format( len(df), ', '.join([ '**{}**'.format(f) for f in cfg.experimental_condition_fields ]))), html.Div([ dcc.Markdown( '-----\n' '**Custom data operations**\n\n' 'Enter any custom apartment data processing code in the field below, and it will be\n' 'applied to the data shown in the following table (after pressing the "Apply" button).\n' 'Examples:\n' '```\n' 'df = df[df[\'apt_num\'] == \'01\']\n' 'df.to_csv(\'/tmp/apartment_data.csv\')\n' 'print(\'Data filtered and saved to csv at "/tmp/apartment_data.csv"\')\n' '```\n\n'), dcc.Textarea(placeholder='', value='', style={ 'width': '100%', 'height': '125px', 'margin-top': '10px' }, id='code-apartments'), html.Button( 'Apply', id='code-apartments-apply', ), ]) ]) ]), html.Div([get_datatable('table-apartments-data', df[fields])]), html.Div([ html.Div(dcc.Graph(id='graph-growth-data'), className='seven columns', style={'margin-top': '10px'}), html.Div([ html.Div(dcc.Dropdown( id='apartment-dropdown', placeholder='Apartment (must be selected in table first)'), style={ 'display': 'inline-block', 'width': '40%' }), html.Div(dcc.Textarea( placeholder='Filter ("hr in [0,24] and hr != 72")', style={ 'width': '100%', 'margin': '0px', 'min-height': '35px', 'height': '35px' }, id='apartment-time-filter'), style={ 'display': 'inline-block', 'width': '45%' }), html.Div(dcc.Checklist(options=[{ 'label': 'Centroids', 'value': 'enabled' }], values=['enabled'], id='enable-cell-marker'), style={ 'display': 'inline-block', 'width': '15%', 'vertical-align': 'top', 'padding-top': '4px' }), html.Div(id='apartment-animation', style={ 'overflow-x': 'scroll', 'white-space': 'nowrap' }), html.Div([ html.Div(dcc.Dropdown( id='export-apartment-type', options=[{ 'label': 'Single TIF', 'value': 'tif' }, { 'label': 'Single TIF (+centroids)', 'value': 'tif_markers' }, { 'label': 'Multi PNG', 'value': 'png' }, { 'label': 'Multi PNG (+centroids)', 'value': 'png_markers' }, { 'label': 'RectLabel Annotations', 'value': 'rectlabel_annotations' }], placeholder='Export Type', clearable=False), style={ 'display': 'inline-block', 'width': '40%', 'margin-top': '1px' }), html.Div(html.Button('Export', id='export-apartment-images', style={ 'width': '100%', 'height': '35px', 'line-height': '18px' }), style={ 'display': 'inline-block', 'width': '60%', 'vertical-align': 'top', 'padding-top': '1px' }) ]) ], className='five columns', style={'margin-top': '0'}) ], className='row'), html.Div(id='null1', style={'display': 'none'}) ]
html.Div(id='laborFreqOut',className='four columns'), html.Div(id='laborSpectroOut', className='four columns'), ],className='row'), html.Div([ html.Div([ html.H4( children = 'Additional Symptoms/Comments', style = { 'color':'#FF2A9C' } ), dcc.Textarea( placeholder='Additional Symptoms/Comments', value='', style={'width': '100%'} ), html.Br(), html.Br(), html.Br(), ],className='four columns'), html.Div([ html.Div(id='pieOut'), ],className='five columns'), html.Div([ ],className='three columns')
dcc.Dropdown( id = 'table-dropdown', options=[{'label': k, 'value': k} for k in schema.keys()], ), html.H5("Select:"), dcc.Dropdown( id = 'table-columns-dropdown', multi=True ), html.Hr(), ]))), dbc.Row(dbc.Col(html.Div([ dcc.Textarea( id='query_input', style={'width':'100%', 'height':'200'}, value="SELECT {columns} FROM {table}" ), html.Button('Ask your OS.', id='query_submit'),#add a link to schema on far right column? html.Div(id='query_table_container')] ))), ]) layout = html.Div([nav,body]) @app.callback( Output('table-columns-dropdown', 'options'), (Input('table-dropdown', 'value'))) def set_columns_dropdown(selected_table): if selected_table is None: return dash.no_update
def uploadPage(): if 'user_id' in session: user = [x for x in users if x.id == session['user_id']][0] g.user = user user_name = user.username else: user_name = " " ## Step 1. Questions for Data Source Information uploadDataInfo = dbc.Container( [ html. H5('Step 1. Fill out the Data Source questionnaire below with appropriate information and links as needed.', id="Instructions"), #### Identifying - Name, Institution, Database Name dbc.Row([ html.Form([ dcc.Input(placeholder='Name', id='uploader-Name', value=str(user_name), type='text'), dcc.Input(placeholder='Institution', id='user-inst', type='text'), dcc.Input(placeholder='Database Name', id='db-name', type='text'), ]), ]), #### Things with URL inputs - Peer Reviewed, Field Method, Lab Method, QA, Full QA dbc.Row([ HalsNamedInlineRadioItems( name="Is the data peer reviewed or published?", id="is-data-reviewed", options=data_Review_options, ), dcc.Input(placeholder='URL Link', type='text', id='publication-url', style={'display': 'none'}), ]), dbc.Row([ HalsNamedInlineRadioItems( name="Is the field method reported?", id="is-field-method-reported", options=data_Review_options, ), dcc.Input(placeholder='URL Link', type='text', id='field-method-report-url', style={'display': 'none'}), ]), dbc.Row([ HalsNamedInlineRadioItems( name="Is the lab method reported?", id="is-lab-method bui-reported", options=data_Review_options, ), dcc.Input(placeholder='URL Link', type='text', id='lab-method-report-url', style={'display': 'none'}), ]), dbc.Row([ HalsNamedInlineRadioItems( name='Is the QA/QC data available?', id="is-qaqc-available", options=data_Review_options, ), dcc.Input(placeholder='URL Link', type='text', id='qaqc-url', style={'display': 'none'}), ]), dbc.Row([ HalsNamedInlineRadioItems( name='Is the full QA/QC data available upon request?', id="is-full-qaqc-available", options=data_Review_options, ), dcc.Input(placeholder='URL Link', type='text', id='full-qaqc-url', style={'display': 'none'}), ]), # Cell Count dbc.Row([ dbc.Row(html.P('Cell count method?')), dbc.Row( dcc.Input(placeholder='URL Link', type='text', id='cell-count-url', style={ 'display': 'inline-block', 'margin-left': '.5rem', 'text-align': 'center' }), ), ]), # Ancillary dbc.Row([ dbc.Row(html.P('Ancillary data available?')), dbc.Row( dcc.Textarea( placeholder='Description of parameters or URL link', id='ancillary-data', style={ 'display': 'inline-block', 'margin-left': '.5rem', 'text-align': 'center' }), ), ]), ], ) ## Step 2. Questions for Methodology Information uploadMethodologies = dbc.Container( [ html. H5('Step 2. Fill out the Methodology questionnaire below with appropriate information and links as needed.', id="Instructions"), # Substrate dbc.Row([ HalsNamedInlineRadioItems( name="Substrate", id="substrate-option", options=Substrate_Status_options, ) ], className="uploadOption"), # Sample Type dbc.Row([ HalsNamedInlineRadioItems( name="Sample Types", id="sample-type-option", options=Sample_Types_options, ), ]), # Field Method dbc.Row([ HalsNamedInlineRadioItems(name="Field Method", id="field-method-option", options=Field_Methods_options), dcc.Input(placeholder='Depth Integrated (m)', type='text', id='vertically-depth-integrated', style={'display': 'none'}), dcc.Input(placeholder='Depth Sampled (m)', type='text', id='discrete-depth-sampled', style={'display': 'none'}), dcc.Input(placeholder='Depth of Sample (m)', type='text', id='spatially-integrated-depth', style={'display': 'none'}), dcc.Input(placeholder='# of samples integrated', type='text', id='num-spatially-integrated-samples', style={'display': 'none'}), ]), #### Microcystin Method and filtering dbc.Row([ HalsNamedInlineRadioItems( name="Microcystin Method", id="microcystin-method", options=Microcystin_Method_options, ), ]), dbc.Row([ HalsNamedInlineRadioItems( name="Was Sample Filtered?", id="sample-filtered", options=data_Review_options, ), dcc.Input(placeholder='Filter Size (μm)', type='text', id='filter-size', style={'display': 'none'}), ]), ], ) ## Step 3. Links to example csv exampleBar = dbc.Container([ html. H5('Step 3. Download the outline file below and copy the appropriate data into the csv file.', id="Instructions"), dbc.Row(html.A("Download Datasheet Outline File", href=dfexampleSheet, target='blank', download='GLEON_GMA_OUTLINE.csv', className="mr-1", style={ 'textAlign': 'center', "padding": "2rem .5rem 2rem .5rem" }), justify="center", form=True), ]) ## Step 4. Spot to upload files dragUpload = dbc.Container([ html. H5('Step 4. Select or drag and drop the filled out csv file containing your data using the provided outline.', id="Instructions"), dcc.Upload( id="upload-data", children=[ "Drag and Drop or ", html.A(children="Select a File"), ], style={ 'width': '100%', 'height': '60px', 'lineHeight': '60px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center', 'margin': '10px' }, accept=".csv, .xls, .xlsx", ), dbc.Row([ HalsNamedInlineRadioItems( name= 'Would you like to password protect this file? If so, users will not be able to download it from the data page.', id="pw-protect", options=data_Review_options, ), dcc.Input(placeholder='Password', type='password', id='pw-protect-txt', style={'display': 'none'}), ]), html.Div(id='upload-output'), ], ) ## Step 5. Upload button and warning about using outline uploadButton = dbc.Container([ html.H5( 'Step 5. Click \'Upload\' to ' 'upload your data and information to the project.', id="Instructions"), html.P( '**Please note, the data must be in the same format as the outline file provided in step 3 above. Failure to use this ' 'outline will likely return an error.**', style={'font-size': '1.5rem'}), html.Button(id='upload-button', n_clicks=0, children='Upload', style={ 'margin': '1rem .5rem .6rem .5rem', 'justify': 'center' }), dbc.Row(html.P(id='upload-msg')), ], ) ## Combines all the questions/forms from above into one section, this is what's actually returned to the page uploadBar = html.Div([ dbc.Col([ dbc.Row(html.H5( "Thank you for your interest in contributing to our data collection! Please follow the 5 steps below to upload your file to our database.", style={'textAlign': 'center'}), justify="center", form=True), dbc.Row(html.A( "Contact us with any questions, problems, or concerns!", href="/PageContact", className="mr-1", style={ 'textAlign': 'center', "padding": "2rem .5rem 2rem .5rem" }), justify="center", form=True), ], className="twelve columns"), dbc.Row(uploadDataInfo, className='pretty_container ten columns offset-by-one'), dbc.Row(uploadMethodologies, className='pretty_container ten columns offset-by-one'), dbc.Row([ dbc.Col(exampleBar, className="pretty_container five columns"), dbc.Col(dragUpload, className="pretty_container five columns"), ], className="ten columns offset-by-one"), dbc.Row(uploadButton, className='pretty_container ten columns offset-by-one') ], className="twelve columns") layout = uploadBar return layout
def get_acl_content(): options = [{'label': 'Cisco IOS', 'value': 'cisco'}, {'label': 'Cisco NX-OS', 'value': 'cisco-nx'}, {'label': 'Cisco XR', 'value': 'cisco-xr'}, {'label': 'Juniper', 'value': 'juniper'}] return html.Div( id="acl_content_container", children=[ html.Div( id="acl_content", children=[ html.Div(children=[ html.Fieldset( id="acl_original_fieldset", children=[html.Legend("Original ACL"), dbc.InputGroup( id="acl_original_input_group", children=[ html.Div([dbc.Button( "Get Configuration", id="acl_get_config_button")]), html.Div( children=[ dbc.InputGroup([ dbc.InputGroupAddon( "Choose Platform", addon_type="prepend"), dbc.Select( id="acl_original_choose_platform", options=options, value='cisco', ), ]), ]), ]), html.Div( id="acl_original_text_area_container", children=[ dcc.Textarea( id='acl_original_textarea', value='', placeholder="Please Copy and Paste an ACL", required=True, ), ]), ]), ]), html.Div([dbc.Button( "Analyze", id="acl_analyze_button")]), html.Div(children=[ html.Fieldset( id="acl_refactored_fieldset", children=[html.Legend("Refactored ACL"), html.Div( id="acl_refactored_choose_platform_container", children=[ dbc.InputGroup([ dbc.InputGroupAddon( "Choose Platform", addon_type="prepend"), dbc.Select( id="acl_refactored_choose_platform", options=options, value='', ), ]), ]), html.Div( id="acl_refactored_text_area_container", children=[ dcc.Textarea( id='acl_refactored_textarea', value='', placeholder="Please Copy and Paste an ACL", required=True, ), ]), ]), ]), ] ), html.Div( id="acl_result_fieldset_container", children=[ html.Fieldset( id="acl_result_fieldset", children=[html.Legend("Results"), html.Div( id="acl_result_table", ), ]), ]), ] )
import dash import dash_html_components as html import dash_bootstrap_components as dbc import dash_core_components as dcc from dash.dependencies import Input, Output app = dash.Dash(__name__) app.layout = html.Div( dbc.Container([ html.Br(), dcc.Textarea(style={ 'width': '100%', 'height': '300px' }, id='input', value='', placeholder='请输入文字内容!'), html.P(id='output') ])) @app.callback(Output('output', 'children'), Input('input', 'value')) def mask_dirty_talk(value): return value.replace('他妈', '**') if __name__ == "__main__": app.run_server(debug=True)
def test_gallery(self): app = dash.Dash(__name__) app.layout = html.Div([ html.Div(id='waitfor'), html.Label('Upload'), dcc.Upload(), html.Label('Horizontal Tabs'), dcc.Tabs( id="tabs", children=[ dcc.Tab(label='Tab one', className='test', style={'border': '1px solid magenta'}, children=[html.Div(['Test'])]), dcc.Tab(label='Tab two', children=[ html.Div([ html.H1("This is the content in tab 2"), html.P("A graph here would be nice!") ]) ], id='tab-one'), dcc.Tab(label='Tab three', children=[ html.Div([ html.H1("This is the content in tab 3"), ]) ]), ], style={'fontFamily': 'system-ui'}, content_style={ 'border': '1px solid #d6d6d6', 'padding': '44px' }, parent_style={ 'maxWidth': '1000px', 'margin': '0 auto' }), html.Label('Vertical Tabs'), dcc.Tabs( id="tabs1", vertical=True, children=[ dcc.Tab(label='Tab one', children=[html.Div(['Test'])]), dcc.Tab(label='Tab two', children=[ html.Div([ html.H1("This is the content in tab 2"), html.P("A graph here would be nice!") ]) ]), dcc.Tab(label='Tab three', children=[ html.Div([ html.H1("This is the content in tab 3"), ]) ]), ]), html.Label('Dropdown'), dcc.Dropdown(options=[{ 'label': 'New York City', 'value': 'NYC' }, { 'label': u'Montréal', 'value': 'MTL' }, { 'label': 'San Francisco', 'value': 'SF' }, { 'label': u'北京', 'value': u'北京' }], value='MTL', id='dropdown'), html.Label('Multi-Select Dropdown'), dcc.Dropdown(options=[{ 'label': 'New York City', 'value': 'NYC' }, { 'label': u'Montréal', 'value': 'MTL' }, { 'label': 'San Francisco', 'value': 'SF' }, { 'label': u'北京', 'value': u'北京' }], value=['MTL', 'SF'], multi=True), html.Label('Radio Items'), dcc.RadioItems(options=[{ 'label': 'New York City', 'value': 'NYC' }, { 'label': u'Montréal', 'value': 'MTL' }, { 'label': 'San Francisco', 'value': 'SF' }, { 'label': u'北京', 'value': u'北京' }], value='MTL'), html.Label('Checkboxes'), dcc.Checklist(options=[{ 'label': 'New York City', 'value': 'NYC' }, { 'label': u'Montréal', 'value': 'MTL' }, { 'label': 'San Francisco', 'value': 'SF' }, { 'label': u'北京', 'value': u'北京' }], values=['MTL', 'SF']), html.Label('Text Input'), dcc.Input(value='', placeholder='type here', type='text', id='textinput'), html.Label('Disabled Text Input'), dcc.Input(value='disabled', type='text', id='disabled-textinput', disabled=True), html.Label('Slider'), dcc.Slider( min=0, max=9, marks={ i: 'Label {}'.format(i) if i == 1 else str(i) for i in range(1, 6) }, value=5, ), html.Label('Graph'), dcc.Graph(id='graph', figure={ 'data': [{ 'x': [1, 2, 3], 'y': [4, 1, 4] }], 'layout': { 'title': u'北京' } }), html.Label('DatePickerSingle'), dcc.DatePickerSingle(id='date-picker-single', date=datetime(1997, 5, 10)), html.Label('DatePickerRange'), dcc.DatePickerRange(id='date-picker-range', start_date=datetime(1997, 5, 3), end_date_placeholder_text='Select a date!'), html.Label('TextArea'), dcc.Textarea(placeholder='Enter a value... 北京', style={'width': '100%'}), html.Label('Markdown'), dcc.Markdown(''' #### Dash and Markdown Dash supports [Markdown](http://commonmark.org/help). Markdown is a simple way to write and format text. It includes a syntax for things like **bold text** and *italics*, [links](http://commonmark.org/help), inline `code` snippets, lists, quotes, and more. 北京 '''.replace(' ', '')), dcc.Markdown(['# Line one', '## Line two']), dcc.Markdown(), dcc.SyntaxHighlighter(dedent('''import python print(3)'''), language='python'), dcc.SyntaxHighlighter(['import python', 'print(3)'], language='python'), dcc.SyntaxHighlighter() ]) self.startServer(app) self.wait_for_element_by_css_selector('#waitfor') self.snapshot('gallery') self.driver.find_element_by_css_selector( '#dropdown .Select-input input').send_keys(u'北') self.snapshot('gallery - chinese character') text_input = self.driver.find_element_by_id('textinput') disabled_text_input = self.driver.find_element_by_id( 'disabled-textinput') text_input.send_keys('HODOR') # It seems selenium errors when send(ing)_keys on a disabled element. # In case this changes we try anyway and catch the particular # exception. In any case Percy will snapshot the disabled input style # so we are not totally dependent on the send_keys behaviour for # testing disabled state. try: disabled_text_input.send_keys('RODOH') except InvalidElementStateException: pass self.snapshot('gallery - text input')
def modal(): contacts["Name"] = ( contacts["Salutation"] + " " + contacts["FirstName"] + " " + contacts["LastName"] ) return html.Div( html.Div( [ html.Div( [ # modal header html.Div( [ html.Span( "New Case", style={ "color": "#506784", "fontWeight": "bold", "fontSize": "20", }, ), html.Span( "×", id="cases_modal_close", n_clicks=0, style={ "float": "right", "cursor": "pointer", "marginTop": "0", "marginBottom": "17", }, ), ], className="row", style={"borderBottom": "1px solid #C8D4E3"}, ), # modal form html.Div( [ # left Div html.Div( [ html.P( "Account name", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), html.Div( dcc.Dropdown( id="new_case_account", options=[ { "label": row["Name"], "value": row["Id"], } for index, row in accounts.iterrows() ], clearable=False, value=accounts.iloc[0].Id, ) ), html.P( "Priority", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), dcc.Dropdown( id="new_case_priority", options=[ {"label": "High", "value": "High"}, {"label": "Medium", "value": "Medium"}, {"label": "Low", "value": "Low"}, ], value="Medium", clearable=False, ), html.P( "Origin", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), dcc.Dropdown( id="new_case_origin", options=[ {"label": "Phone", "value": "Phone"}, {"label": "Web", "value": "Web"}, {"label": "Email", "value": "Email"}, ], value="Phone", clearable=False, ), html.P( "Reason", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), dcc.Dropdown( id="new_case_reason", options=[ { "label": "Installation", "value": "Installation", }, { "label": "Equipment Complexity", "value": "Equipment Complexity", }, { "label": "Performance", "value": "Performance", }, { "label": "Breakdown", "value": "Breakdown", }, { "label": "Equipment Design", "value": "Equipment Design", }, { "label": "Feedback", "value": "Feedback", }, {"label": "Other", "value": "Other"}, ], value="Installation", clearable=False, ), html.P( "Subject", style={ "float": "left", "marginTop": "4", "marginBottom": "2", }, className="row", ), dcc.Input( id="new_case_subject", placeholder="The Subject of the case", type="text", value="", style={"width": "100%"}, ), ], className="six columns", style={"paddingRight": "15"}, ), # right Div html.Div( [ html.P( "Contact name", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), html.Div( dcc.Dropdown( id="new_case_contact", options=[ { "label": row["Name"], "value": row["Id"], } for index, row in contacts.iterrows() ], clearable=False, value=contacts.iloc[0].Id, ) ), html.P( "Type", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), dcc.Dropdown( id="new_case_type", options=[ { "label": "Electrical", "value": "Electrical", }, { "label": "Mechanical", "value": "Mechanical", }, { "label": "Electronic", "value": "Electronic", }, { "label": "Structural", "value": "Structural", }, {"label": "Other", "value": "Other"}, ], value="Electrical", ), html.P( "Status", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), dcc.Dropdown( id="new_case_status", options=[ {"label": "New", "value": "New"}, { "label": "Working", "value": "Working", }, { "label": "Escalated", "value": "Escalated", }, {"label": "Closed", "value": "Closed"}, ], value="New", ), html.P( "Supplied Email", style={ "textAlign": "left", "marginBottom": "2", "marginTop": "4", }, ), dcc.Input( id="new_case_email", placeholder="email", type="email", value="", style={"width": "100%"}, ), html.P( "Description", style={ "float": "left", "marginTop": "4", "marginBottom": "2", }, className="row", ), dcc.Textarea( id="new_case_description", placeholder="Description of the case", value="", style={"width": "100%"}, ), ], className="six columns", style={"paddingLeft": "15"}, ), ], style={"marginTop": "10", "textAlign": "center"}, className="row", ), # submit button html.Span( "Submit", id="submit_new_case", n_clicks=0, className="button button--primary add" ), ], className="modal-content", style={"textAlign": "center", "border": "1px solid #C8D4E3"}, ) ], className="modal", ), id="cases_modal", style={"display": "none"}, )
], value = intervals[0], placeholder="Filter by interval", clearable=True ) ], width={'size':3}), # Filter 3: Forecast period (days) dbc.Col([ html.H5("Forecast Period (days):",style={'color': 'white','text-align': 'left'}), dcc.Textarea( id = 'forecast_period', placeholder=' days', value = '5', # value='Textarea content initialized\nwith multiple lines of text', style={'width': '100%'} ) ,\ ], width={'size':3}), dbc.Col([ html.Br(), html.Br(), dbc.Button(children='Apply', color="dark",size="lg", id="submit_btn",n_clicks=0, className="mr-1"), ], width={'size':3}), ],style={'backgroundColor': "#003B70"}),
def create_app_ui(): global dfff dfff = pd.read_csv('ETSY.csv') # Create the UI of the Webpage here main_layout = html.Div([ html.H1(id='Main_title', children='Sentiment Analysis with Insights', style={ "text-align": "center", "font-size": "300%" }), #piechart section html.H1(children='Pie Chart', id='Main_title2', style={ 'textAlign': 'center', 'color': 'blue' }), html.Label("Pie Chart of reviews"), dcc.Graph(id="piechart", figure=None), #review_check section html.H1(children='Review Check Section', id='Main_title3', style={ 'textAlign': 'center', 'color': 'blue' }), #dropdown dcc.Dropdown( id='drop_down', options=[{ 'label': i, 'value': i } for i in dfff['Reviews_df'].sample(50)], optionHeight=100, searchable=True, ), html.Button(children='Find Review of the selected data', id='button_click', n_clicks=0, style={ 'color': 'Red', "border": "5px solid black" }), html.H1(children=None, id='result', style={ 'textAlign': 'center', 'color': 'red' }), #text_review dcc.Textarea( id="textarea_review", placeholder="Enter the Review here.....", style={ "width": "100%", "height": 100, "background-color": "orange", "font-size": "160%", "font-family": "verdana", "color": "white", "border": "5px solid black" }, ), html.Button(children='Find Review of the entered data', id='button_click1', n_clicks=0, style={ 'color': 'Red', "border": "5px solid black" }), html.H1(children=None, id='result1', style={ 'textAlign': 'center', 'color': 'red' }), ]) return main_layout
import dash_labs as dl import dash import numpy as np import dash_core_components as dcc import plotly.express as px app = dash.Dash(__name__, plugins=[dl.plugins.FlexibleCallbacks()]) tpl = dl.templates.FlatDiv() dropdown = dcc.Dropdown(options=[{ "label": i, "value": i } for i in ["sin", "cos", "exp"]], value="sin") textbox = dcc.Textarea("Initial Title") slider = dcc.Slider(min=1, max=10, value=2, tooltip={ "placement": "bottom", "always_visible": True }) slider2 = dcc.Slider(min=1, max=10, value=6, tooltip={ "placement": "bottom", "always_visible": True })
html.H3('STEP 2', style = {'margin-top':'0'}), html.Div( [ html.Div( [ html.Div( [ html.P([ 'Insert crRNA sequence(s), one per line.', html.P('Sequences must have the same length and be provided without the PAM sequence') , #html.Abbr('\uD83D\uDEC8', style = {'text-decoration':'none'} ,title = 'One sequence per line. All sequences must have the same lenght and PAM characters are not required') ], style = {'word-wrap': 'break-word'}), dcc.Textarea(id = 'text-guides', placeholder = 'GAGTCCGAGCAGAAGAAGAA\nCCATCGGTGGCCGTTTGCCC', style = {'width':'450px', 'height':'160px'}), html.P('or', style = {'position': 'relative', 'left':'50%'}), html.Div( [ html.Div( [ dcc.Upload('Upload file with crRNA sequences', id = 'upload-guides') ], style={ 'width': '100%', 'height': '60px', 'lineHeight': '60px', 'borderWidth': '1px', 'borderStyle': 'dashed', 'borderRadius': '5px', 'textAlign': 'center',
'textAlign': 'center', 'color': 'black' }), html.Br(), html.Br(), ]) input_2 = html.Div( style={'backgroundColor': 'cornsilk'}, children=[ html.Div( dcc.Textarea( id="input2", placeholder="please insert case text... the more the better", style={ 'display': 'block', 'textAlign': 'center', 'width': '50%', 'margin-left': 'auto', 'margin-right': 'auto' })), html.Button('Submit', id='button', type='submit', style={ 'display': 'block', 'textAlign': 'center', 'width': '50%', 'margin-left': 'auto', 'margin-right': 'auto' }), html.Br(),
def layout(code): return html.Div([ html.Div([ html.Div([ dcc.Dropdown( id='goo_ba', options=[{'label': r, 'value': v} for r, v in zip(["Good", "Great", "Bad", "Severe"], ["good", "great", "bad", "severe"])], value="good", clearable=False, className="dropper" ) ], style={'background-color': "white", 'color': 'rgb(217, 224, 236)', 'float': 'left', 'padding-right': '1cm', 'width': '19%'}), html.Div([ dcc.Dropdown( id='time', options=[{'label': r, 'value': v} for r, v in zip(["All Observations","Recent vs Past","Last Six Month", "Last Year","Last Three Years", "Last Five Years","First Five Years"], ["alltime","rvp","six month","year","three_years", "five_years","five_years_ago"])], value="alltime", clearable=False, className="dropper" ) ], style={'background-color': 'white', 'color': 'rgb(217, 224, 236)', 'float': 'left', 'padding-right': '1cm', 'width': '19%'}), html.Div([ dcc.Dropdown( id='many', options=[{'label': r, 'value': v} for r, v in zip(["One Noun","Two Words","Phrase"],["1","2","3"])], value="3", clearable=False, className="dropper" ) ], style={'background-color': 'white', 'padding-right': '1cm', 'color': 'rgb(217, 224, 236)', 'float': 'left', 'width': '19%'}), html.Div([ dcc.Dropdown( id='norm', options=[{'label': r, 'value': v} for r, v in zip(["Relative", "Count"], ["False","True"])], value="True", clearable=False, className="dropper" ) ], style={'background-color': 'white', 'padding-right': '1cm', 'color': 'rgb(217, 224, 236)', 'float': 'left', 'width': '19%'}), html.Div([ dcc.Dropdown( id='bencher', options=[{'label': r, 'value': v} for r, v in zip(input_fields["short_name"], input_fields["code_or_ticker"])], value="BJRI", clearable=False, className="dropper" ) ], style={'background-color': 'white', 'padding-right': '1cm', 'color': 'rgb(217, 224, 236)', 'float': 'left', 'width': '19%'}), # , 'float': 'right', 'display': 'inline-block' ], style={'background-color': 'white', 'padding-left': '1.8cm', 'clear': 'both', 'padding-top': '0.3cm'}, className="double_drop"), html.Div([dcc.Graph(id='graphed',config={'displayModeBar': False})], style={'clear':'both'}), html.Div([dcc.Textarea(id='text_sum', placeholder='Summary', value='Component', style={'width': '100%', 'height':'140px'} )], style={'padding-top':'25px','clear':'both'}) ])