def contact(): return dbc.Container( [ dbc.Card( [ dbc.CardBody( [ dbc.CardTitle("Norbert Dojer, PhD.", className="text-info"), dbc.CardText(html.P("*****@*****.**")), ] ), ], outline=True, color="info" ), dbc.Card( [ dbc.CardBody( [ dbc.CardTitle("Paulina Dziadkiewicz, B.Sc.", className="text-info"), dbc.CardText("*****@*****.**"), ] ) ], outline=True, color="info", ) ] )
def page_1_dropdown(value): children = [] if datafr.tempflag == 0: if (datafr.steps == 0): finals = "Hello" finals1 = "Press start to continue..." if datafr.temps != finals: datafr.temps += finals[datafr.varcount] datafr.varcount += 1 if datafr.temps == finals: datafr.varcount = 0 if datafr.temps1 != finals1: datafr.temps1 += finals1[datafr.varcount1] datafr.varcount1 += 1 if datafr.temps1 == finals1: datafr.varcont1 = 0 datafr.steps += 1 children = [ dbc.Card( [ dbc.CardBody([ dbc.CardTitle(datafr.temps), dbc.CardText(datafr.temps1), ]) ], outline=True, color="primary", ) ] if (datafr.steps == 1): children = [ dbc.Card( [ dbc.CardBody([ dbc.CardTitle("Enter Your Name"), dbc.CardText("Hi"), dcc.Link('Go to Page 1', href='/page-1'), ]) ], outline=True, color="primary", ) ] return children
def display_reddit_posts(n_clicks, subreddit_choice, user_id): """ For the Reddit API, allow the user to specify a subreddit \ to get data from. Args: n_clicks (int): Number of times button was clicked. subreddit_choice (str): The name of the subreddit. user_id (str): Session/user id. Returns: list: A list of dash components. """ if n_clicks is not None and n_clicks >= 1: if subreddit_choice is not None: api = pickle.loads(r.get(f"{user_id}_reddit_api_handle")) subreddit = api.subreddit(subreddit_choice) posts = [ html.Div([ dbc.Card([ dbc.CardHeader([ html.H4(post.title), html.A("view at reddit", href=post.permalink), ]), dbc.CardBody([ dbc.CardTitle(f"Written by {post.author.name}, " f"score: {post.score}"), dbc.CardText(dcc.Markdown(post.selftext), ), ]), ]), html.Br(), ]) for post in subreddit.hot(limit=5) ] return posts else: return [html.H4("No subreddit choice")] else: return [html.H4("No reddit data to display.")]
def get_summary(dfs): """ Gets a list of h6 with data from previous month """ mdate = date.today() date_m1 = mdate.replace(day=1) - timedelta(days=1) date_m2 = date_m1.replace(day=1) - timedelta(days=1) # Get stats for last month and the month previous to the last one stats = _get_stats(dfs, date_m1) stats2 = _get_stats(dfs, date_m2) # Header of the summary data = [["Stats for months", "{:%Y/%m} ({:%Y/%m})".format(date_m1, date_m2), "secundary"]] # Fill the summary with relevant stats for name, color in c.colors.COLORS_CARDS.items(): # bool stating if it is better than previous month (expenses should be reversed) aux = stats[name] > stats2[name] symbols = ARROWS[not aux if name == c.names.EXPENSES else aux] # space as thousand separator text = f"{stats[name]:,.0f}€ ({stats2[name]:,.0f}€) {symbols}".replace(",", ".") data.append([name, text, color]) # Show a text with transactions excel file date name = get_money_lover_filename() data.append(["Using data from", name.split(".")[0].replace("-", "/"), "secundary"]) return dbc.CardDeck( [ dbc.Card( [dbc.CardTitle(title), dbc.CardText(text)], color=color, className="w3-center", style=lay.padding(), ) for title, text, color in data ], style=lay.padding(), )
def __init__(self, function=lambda x: None, button_text='Button', button_color='primary', button_class='mr-1', button_id=None, description='FunctionInputCardWithButton'): self._defaults = dict_default_args(function) self._function = function self._html = dbc.Card([ dbc.CardHeader(description), dbc.CardBody([ dbc.CardText( html.Div( inputs_from_dict(self._defaults, id_prefix=str(self)))) ]), dbc.CardFooter( dbc.Button(button_text, color=button_color, className=button_class, id=button_id)) ])
def generateLinks(children): linklist = [] for k,v in dashboards.items(): link = dbc.CardLink("{}".format(k), href=relpath(v), style={'text-align':'center'}) try: desc = dbc.CardText(eval(v.replace("/","")).description, style={'text-align':'center'}) linklist.append(dbc.Card([link,desc], body=True, color='light', # outline=False, inverse=False)) except Exception as e: logger.exception('') linklist.append(dbc.Card([link], body=True, color='light', # outline=False, inverse=False)) return linklist
def cartTotalscard(s, e): mask = (cart_no['cart_created_date'] > s) & (cart_no['cart_created_date'] <= e) cdf = cart_no[mask] cdf_sum = cdf.groupby(['program']).agg({ 'cart_number': 'sum' }).reset_index() totals =[(i, cdf_sum[cdf_sum['program'] == i].iloc[0]['cart_number']) \ for i in cdf_sum['program']] cards = [] for x in totals: card = \ dbc.Card( [ # dbc.CardHeader("{}".format(x[0])), dbc.CardBody( [ dbc.CardTitle("{}".format(x[1]), style={'font-size':'2em'}), dbc.CardText("{}".format(x[0].replace("_"," "))), ] ), ]) cards.append(card) return cards
def update_graph_interactive_image(content, new_filename): if (content is not None): string = content.split(';base64,')[-1] imgdata = base64.b64decode(string) new_filename = new_filename.split(".")[0] filename = 'image/' + new_filename + '.png' filename1 = 'image/' + new_filename + '.jpeg' # I assume you have a way of picking unique filenames with open(filename, 'wb') as f: f.write(imgdata) with open(filename1, 'wb') as f: f.write(imgdata) #image = Image.fromstring('RGB',(200,200),decodestring(string)) # Do You processing here ---------------- # Manipulate here finaltryfit.mains(new_filename) ################################## string = '' with open("output/im_rec.png", "rb") as imageFile: string = base64.b64encode(imageFile.read()).decode("utf-8") img1 = '' with open("output/output11.png", "rb") as imageFile: img1 = base64.b64encode(imageFile.read()).decode("utf-8") originalcard = html.Div([ dbc.Card( [ dbc.CardBody([dbc.CardTitle(new_filename)]), dbc.CardImg( src=('data:image/png;base64,{}'.format(string))), dbc.CardBody([ dbc.CardText( html.P("Image with geometrical coordinates")), ]), ], style={"max-width": "250px"}, ), ], className="twelve columns") VariableOne = dbc.Card( [ dbc.CardBody([dbc.CardTitle("Processed Image")]), dbc.CardImg(src=('data:image/jpg;base64,{}'.format(img1))), dbc.CardBody([ dbc.CardText("Masked Image"), ]), ], style={"max-width": "250px"}, ) return [ html.Div([ dbc.Card([ dbc.CardHeader("Input Image \u2b50"), dbc.CardBody([ html.Div([ html.Div([originalcard], className="five columns offset-by-four"), ], className='row'), ]), ]) ], className="twelve columns"), html.Div([ dbc.Card([ dbc.CardHeader("Output Image \u2b50"), dbc.CardBody([ html.Div([ html.Div([VariableOne], className="five columns offset-by-four"), ], className='row'), ]), ]) ], className="twelve columns", style={'margin-bottom': '3%'}) ] else: return []
import dash_bootstrap_components as dbc import dash_html_components as html from ..aqa_app import app # define content for page 1 page1 = dbc.Card( [ dbc.CardTitle("Page 1 contents"), dbc.CardText("You can replace this with whatever you like"), ], body=True, ) layout = html.Div(page1)
import dash_bootstrap_components as dbc cards = dbc.CardDeck( [ dbc.Card( [ dbc.CardHeader("Header"), dbc.CardBody( [ dbc.CardTitle("This card has a title"), dbc.CardText("And some text"), ] ), ] ), dbc.Card( [ dbc.CardBody( [ dbc.CardTitle("This card has a title"), dbc.CardText("and some text, but no header"), ] ) ], outline=True, color="primary", ), dbc.Card( [ dbc.CardBody( [
key_assumptions_description2 = '2. Where claims had multiple procedure codes, and thus multiple medicare rates, the medicare rates were averaged' data_pull_time = time.strftime('%b %d, %Y %H:%M:%S', time.localtime(os.path.getmtime('data/current/in_network_profitability_evaluation/claims_data.csv'))) ################################################################################ layout = html.Div([ dbc.Container( [ dbc.Card([ dbc.CardHeader(title, style={'font-size':'2em'}), dbc.CardBody( [ dbc.Button("Click here for more information on this dashboard", id="collapse-button_inpe", className="mb-3"), dbc.Collapse( [ dbc.CardText( html.P(children=functionality_description), #html.H6('Data Pulled', style = {'marginBottom':0}), #html.Div(id=date_of_pull_srm, children=time.strftime('%b %d, %Y %H:%M', time.localtime(os.path.getmtime('data/samples_reports_metrics/orders_data.csv')))) ) ], id='collapse_inpe', is_open=False ) ] )]), dbc.Row([ dbc.Col( [ html.P(children='Claim Issued Between'), dcc.DatePickerRange( id='date_picker_range_state', min_date_allowed=start_date,
dbc.Button("Secondary", color="secondary"), dbc.Button("Success", color="success"), dbc.Button("Warning", color="warning"), dbc.Button("Danger", color="danger"), dbc.Button("Info", color="info"), ])), ]) cards = html.Div([ html.H2("Cards"), dbc.CardDeck([ dbc.Card([ dbc.CardHeader("Header"), dbc.CardBody([ dbc.CardTitle("This card has a title"), dbc.CardText("And some text"), ]), ]), dbc.Card( [ dbc.CardBody([ dbc.CardTitle("This card has a title"), dbc.CardText("and some text, but no header"), ]) ], outline=True, color="primary", ), dbc.Card( [ dbc.CardBody([
html.Div(id="startbtnoutput", children=[]), ]), ), ], no_gutters=True), ], style={ 'margin-bottom': '300px', 'margin-top': '20px' }), html.Div([ html.Div([ dbc.Card( [ dbc.CardBody([ dbc.CardTitle("This card has a title"), dbc.CardText("and some text, but no header"), ]) ], outline=True, color="primary", className="card", ), ], className='card'), ], className='ten columns offset-by-one'), html.Link(href='/assets/stylesheet.css', rel='stylesheet'), gdc.Import(src="https://code.jquery.com/jquery-3.3.1.min.js"), gdc.Import(src="assets\z.js"), html.Div([ dash_dangerously_set_inner_html.DangerouslySetInnerHTML('''
import dash_bootstrap_components as dbc cards = dbc.CardColumns( [ dbc.Card( [ dbc.CardHeader("These cards are arranged in columns"), dbc.CardBody( [ dbc.CardTitle("This is a title"), dbc.CardText("And some text\nmore text\nmore text"), ] ), ] ), dbc.Card( [ dbc.CardHeader("Another card"), dbc.CardBody( [ dbc.CardTitle("This is a title"), dbc.CardText("And some text"), ] ), ], color="dark", inverse=True, ), dbc.Card( [ dbc.CardHeader("Yet another card"),
import dash_bootstrap_components as dbc cards = dbc.Card( [ dbc.CardBody( [dbc.CardTitle("Card title"), dbc.CardSubtitle("Card subtitle")] ), dbc.CardImg( src=( "https://placeholdit.imgix.net/~text?" "txtsize=33&txt=318%C3%97180&w=318&h=180" ) ), dbc.CardBody( [ dbc.CardText( "Some quick example text to build on the " "card title and make up the bulk of the " "card's content." ), dbc.CardLink("A link", href="#"), dbc.CardLink("Another link", href="#"), ] ), ], style={"max-width": "320px"}, )
def orders_card(submit_button, product, kit_type, upgrade_type): t0 = time.time() df_orders = feather.read_dataframe('app/data/current/orders/orders_data.feather') orders_cards_current = [] orders_cards_previous = [] #date variables current_day = pd.Timestamp(datetime.now().date()) first_day_current_month = month_dates()[0] current_day_previous_month = current_day - relativedelta(months=1) first_day_previous_month = month_dates()[2] df_orders_filtered = df_orders #Product Filtering if product != 'all': df_orders_filtered = df_orders_filtered[df_orders_filtered['code'] == product] #Kit Filtering if kit_type != 'all': df_orders_filtered = df_orders_filtered[df_orders_filtered['kit_type'] == kit_type] #Upgrade Filtering if upgrade_type != 'all': df_orders_filtered = df_orders_filtered[df_orders_filtered['upgrade_type'] == upgrade_type] #Count of Orders MTD count_orders_mtd = df_orders_filtered[(df_orders_filtered['order_created_at'] >= first_day_current_month) & (df_orders_filtered['order_created_at'] < (current_day + relativedelta(days=1)))].order_id.nunique() card = dbc.Card( [ dbc.CardBody( [ dbc.CardHeader("Current MTD # Orders", style={'font-size':'1em'}), dbc.CardText("{}".format(count_orders_mtd), style={'font-size':'2em'}), ] ), ]) orders_cards_current.append(card) #Count of Upgrades MTD count_upgrades_mtd = df_orders_filtered[(df_orders_filtered['order_created_at'] >= first_day_current_month) & (df_orders_filtered['order_created_at'] < (current_day + relativedelta(days=1))) & (df_orders_filtered['upgrade_type'] == 'upgrade')].order_id.nunique() #change date card = dbc.Card( [ dbc.CardBody( [ dbc.CardHeader("Current MTD # Upgrades", style={'font-size':'1em'}), dbc.CardText("{}".format(count_upgrades_mtd), style={'font-size':'2em'}), ] ), ]) orders_cards_current.append(card) #Count of Kit 1 Orders MTD count_kit_1_orders_mtd = df_orders_filtered[(df_orders_filtered['order_created_at'] >= first_day_current_month) & (df_orders_filtered['order_created_at'] < (current_day + relativedelta(days=1)))].kit_1_id.nunique() card = dbc.Card( [ dbc.CardBody( [ dbc.CardHeader("Current MTD # Kit 1 Orders", style={'font-size':'1em'}), dbc.CardText("{}".format(count_kit_1_orders_mtd), style={'font-size':'2em'}), ] ), ]) orders_cards_current.append(card) #Count of Orders Previous MTD count_orders_mtd = df_orders_filtered[(df_orders_filtered['order_created_at'] >= first_day_previous_month) & (df_orders_filtered['order_created_at'] < current_day_previous_month + relativedelta(days=1))].order_id.nunique() #change date card = dbc.Card( [ dbc.CardBody( [ dbc.CardHeader("Previous MTD # Orders", style={'font-size':'1em'}), dbc.CardText("{}".format(count_orders_mtd), style={'font-size':'2em'}), ] ), ]) orders_cards_previous.append(card) #Count of Upgrades Previous MTD count_upgrades_mtd = df_orders_filtered[(df_orders_filtered['order_created_at'] >= first_day_previous_month) & (df_orders_filtered['order_created_at'] < current_day_previous_month + relativedelta(days=1)) & (df_orders_filtered['upgrade_type'] == 'upgrade')].order_id.nunique() #change date card = dbc.Card( [ dbc.CardBody( [ dbc.CardHeader("Previous MTD # Upgrades", style={'font-size':'1em'}), dbc.CardText("{}".format(count_upgrades_mtd), style={'font-size':'2em'}), ] ), ]) orders_cards_previous.append(card) #Count of Kit 1 Orders Previous MTD count_kit_1_orders_mtd = df_orders_filtered[(df_orders_filtered['order_created_at'] >= first_day_previous_month) & (df_orders_filtered['order_created_at'] < current_day_previous_month + relativedelta(days=1))].kit_1_id.nunique() #change date card = dbc.Card( [ dbc.CardBody( [ dbc.CardHeader("Previous MTD # Kit 1 Orders", style={'font-size':'1em'}), dbc.CardText("{}".format(count_kit_1_orders_mtd), style={'font-size':'2em'}), ] ), ]) orders_cards_previous.append(card) t1 = time.time() print('orders cards', t1-t0) return dbc.CardColumns(orders_cards_current, style={'text-align':'center'}), dbc.CardColumns(orders_cards_previous, style={'text-align':'center'})
app1实例 """ import pandas as pd import dash_core_components as dcc import dash_html_components as html import dash_bootstrap_components as dbc from dash.dependencies import Output, Input from Dash.app import app # 全局变量 df = pd.read_csv("apps/data.csv") # 构造components tab1_content = dbc.Card(children=dbc.CardBody([ dbc.CardText("This is tab 1!"), dbc.Button("Click here", color="success"), ])) tab2_content = dbc.Card(children=dbc.CardBody([ dbc.CardText("This is tab 2!"), dbc.Button("Don't click here", color="danger"), ])) def generate_table(dataframe, max_rows=10, size="md"): """ 创建表 """ # Headers headers = [html.Th(col, className="text-center") if index != 1 else html.Th(col) for index, col in enumerate(dataframe.columns[:10])]
# mt-4 is margin top 4px # vh-100 is view height 100% of window className="vh-100 d-flex align-items-center justify-content-center", ) # About page, brief introduction about the app about_pg = dbc.Container( id='about', children=[ dbc.Row( dbc.Card([ dbc.CardHeader("Holy Grail"), dbc.CardBody([ dbc.CardTitle("Your skincare recommender app"), dbc.CardText( "Input your favorite product and let Holy Grail recommend other similar products." "You can use the dropdown list to see the recommended products and choose one of them to explore ratings for the products." ), ]), ]), ) ], className="vh-100 d-flex align-items-center justify-content-center", ) # start page where users specify their characteristics start_pg = dbc.Container( id='start', children=[ dbc.Row([ dbc.Col( dbc.FormGroup([ dbc.Label('Your age range'),
def render_table(api_choice, user_id): """ Create a display for the chosen dataset. Args: api_choice (str): Value from the dropdown. user_id (str): Session/user id. Returns: list: A list of dash components. """ if api_choice is None: return [html.H4("Nothing selected.")] if api_choice == "twitter_api": api = pickle.loads(r.get(f"{user_id}_{api_choice}_handle")) return pretty_print_tweets(api, 5) elif api_choice == "reddit_api": # No need to get the api here # TODO: But maybe this change? return [ html.H4("Write the name of a subreddit:"), dcc.Input( id="subreddit_choice", type="text", value="", ), html.Button("Gimme dem reddits", id="reddit_submit"), html.Br(), html.Br(), html.Div(id="subreddit_posts"), ] elif api_choice == "spotify_api": spotify = pickle.loads(r.get(f"{user_id}_{api_choice}_handle")) top_playlists = spotify.category_playlists( "toplists")["playlists"]["items"] posts = [ html.Div([ dbc.Card([ dbc.CardHeader([ html.H4(playlist["name"]), html.A("listen on Spotify", href=playlist["external_urls"]["spotify"]), ]), dbc.CardBody([ dbc.CardTitle( f"Owner: {playlist['owner']['display_name']}"), dbc.CardText( f"{playlist['tracks']['total']} total tracks"), ]), ]), html.Br(), ]) for playlist in top_playlists ] return posts elif api_choice == "quandl_api": df = get_data(api_choice, user_id) else: df = get_data(api_choice, user_id) if df is None: return [html.H4("Nothing to display")] df = df[df.columns[:10]] return [ html.Br(), create_table(df), ]
*** Use the *Questions? Contact* dropdown for support on the Cash Pay Program or this Dashboard __Site Event Analytics can be viewed on the [RoadRunner Analytics by Ian Mathew on HEAP](https://heapanalytics.com/app/dashboard/Cashpay-Dashboard-71320)__ __[Checkout Analysis by Doh Jung on Metabase](https://metabase.ubiome.io/dashboard/264?freqeuncy=week)__ ''' topcard = dbc.Card( [ dbc.CardHeader("Cash Pay Program Metrics", style={'font-size':'2em'}), dbc.CardBody( [ dbc.CardTitle("How to Use"), dbc.CardText(dcc.Markdown(summary)) ])]) ############################################################################### #### NAVBAR ############################################################################### # navbar = dbc.NavbarSimple( # children=[ # dbc.NavItem(dbc.NavLink("Dashboard Home", href="#")), # dbc.DropdownMenu( # nav=True, # in_navbar=True, # label="Questions? Contact:", # children=[ # dbc.DropdownMenuItem("Cash Pay PM: Devon Rose",
def get_task_description_layout(jsonpangenome: PangenomeJSON) -> dbc.CardDeck(): fasta_provider_paragraph = html.P() if jsonpangenome.task_parameters.multialignment_format == "Maf": opt = jsonpangenome.task_parameters.fasta_complementation_option if opt == "ConstSymbolProvider": o = f"Const symbol {jsonpangenome.task_parameters.missing_base_symbol}" elif opt == "FromFile": o = f"Fasta file {jsonpangenome.task_parameters.fasta_source_file}" else: o = "NCBI" fasta_provider_paragraph = html.P(f"Fasta provider: {o}") if jsonpangenome.task_parameters.consensus_type == "poa": cons_type_paragraph = [html.P(f"Hbmin: {jsonpangenome.task_parameters.hbmin}")] else: cons_type_paragraph = [html.P(f"P: {jsonpangenome.task_parameters.p}"), html.P(f"Stop: {jsonpangenome.task_parameters.stop}")] return dbc.CardDeck( [ dbc.Card( [ dbc.CardBody( [ dbc.CardText([ html.P(f"Multialignment: {jsonpangenome.task_parameters.multialignment_file_path}"), html.P(f"Metadata : {jsonpangenome.task_parameters.metadata_file_path}"), fasta_provider_paragraph ] ), ] ), dbc.CardFooter("PoaGraph Configuration", className="text-center"), ], outline=True, color="dark", ), dbc.Card( [ dbc.CardBody( [ dbc.CardText([ html.P(f"Algorithm: {jsonpangenome.task_parameters.consensus_type}"), html.P(f"Blosum file: {jsonpangenome.task_parameters.blosum_file_path}")] + cons_type_paragraph ), ] ), dbc.CardFooter("Consensus Configuration", className="text-center"), ], outline=True, color="dark", ), dbc.Card( [ dbc.CardBody( [ dbc.CardText([ html.P(f"Time: {jsonpangenome.task_parameters.running_time}"), html.P(f"Poagraph nodes count: {len(jsonpangenome.nodes)}"), html.P(f"Sequences count: {len(jsonpangenome.sequences)}"), html.P(f"Consensuses count: {len(jsonpangenome.consensuses)}"), ] ), ] ), dbc.CardFooter("Processing info", className="text-center"), ], outline=True, color="dark", ), ] )
def index(): return dbc.Container( html.Div([ dbc.Jumbotron(children=[dbc.Row( [dbc.Col([html.H2("PangTreeBuild"), html.P("is a tool for multiple sequence alignment analysis."), html.H2("PangTreeVis"), html.P("visualises the results in browser.") ], className="col-md-8"), dbc.Col(html.I(className="fas fa-seedling fa-10x logo"), className="col-md-4")])]), dbc.Row( dbc.CardDeck( [ dbc.Card( [ dbc.CardHeader(dbc.Row([dbc.Col(html.I(className="fas fa-bezier-curve fa-2x"), className="col-md-3 my-auto"), html.P( "Build graph representation of multiple sequence alignment", className="col-md-9 my-auto")])), dbc.CardBody( [ dbc.CardText( html.Ul([html.Li( ["Input formats: ", html.A("MAF", href="http://www1.bioinf.uni-leipzig.de/UCSC/FAQ/FAQformat.html#format5", target="_blank"), ", ", html.A("PO", href="https://github.com/meoke/pang/blob/master/README.md#po-file-format-specification", target="_blank")]), html.Li(["Internal representation: ", html.A("Partial Order graph", href="https://doi.org/10.1093/bioinformatics/18.3.452", target="_blank")]), html.Li(["Cycles in graph removed with ", html.A("Mafgraph", href="https://github.com/anialisiecka/Mafgraph", target="_blank")]), html.Li("Complement missing parts from NCBI or fasta")])) ] ), ] ), dbc.Card( [ dbc.CardHeader(dbc.Row([dbc.Col(html.I(className="fas fa-grip-lines fa-2x"), className="col-md-3 my-auto"), html.P("Find sequences consensus", className="col-md-9 my-auto")])), dbc.CardBody( [ dbc.CardText( ["This tool extends Partial Order Alignment (POA) algorithm introduced by ", html.A("Lee et al.", href="https://doi.org/10.1093/bioinformatics/18.3.452", target="_blank"), ". It provides:", html.Ul([html.Li([html.Strong("Consensuses"), " - agreed representations of input subsets"]), html.Li([html.Strong("Consensus Tree"), " - a structure similar to phylogenetic tree but it has a consensus assigned to every node"]), html.Li([html.Strong("Compatibility"), " - a measure of similarity between sequence and consensus"])]) ]), ] ), ] ), dbc.Card( [ dbc.CardHeader(dbc.Row([dbc.Col(html.I(className="fas fa-eye fa-2x"), className="col-md-3 my-auto"), html.P("Visualise results", className="col-md-9 my-auto")])), dbc.CardBody( [ dbc.CardText( [ html.Ul([html.Li( "MAF blocks graph"), html.Li("Multiple sequence alignment as Partial Order Graph"), html.Li("Consensus tree"), html.Li("Compatibilities relations")] )]) ] ), ] ), ] ) ) ]) )
dbc.Button("outline", size="md", outline=True, className="mr-2"), dbc.Button("outline", size="lg", outline=True, className="mr-2"), ], className="mt-2"), html.Div(children=[ dbc.Button("Open collapse", id="collapse-button"), dbc.Collapse(dbc.Card( dbc.CardBody("This content is hidden in the collapse")), id="collapse") ], className="mt-2"), html.Div(children=[ dbc.Button("Toggle fade", id="fade-button"), dbc.Fade( dbc.Card( dbc.CardBody(dbc.CardText("This content fades in and out"))), id="fade", is_in=True, appear=False, ), ], className="mt-2"), html.Div(children=[ html.P([ "Click on the word ", html.Span("popover", id="popover-target", className="text-info") ]), dbc.Popover([ dbc.PopoverHeader("Popover header"), dbc.PopoverBody("Popover body"), ],
def update_graph_interactive_images(content, new_filename, dictvariables, number, labels, knob): if (content is not None): # Base64 string of the input image string = content.split(';base64,')[-1] imgdata = base64.b64decode(string) filename = 'some_image.png' # I assume you have a way of picking unique filenames with open(filename, 'wb') as f: f.write(imgdata) #image = Image.fromstring('RGB',(200,200),decodestring(string)) # Do You processing here ---------------- basewidth = 224 img = Image.open('some_image.png') img = img.convert('RGB') wpercent = (basewidth / float(img.size[0])) hsize = int((float(img.size[1]) * float(wpercent))) datafr.H = 224 img = img.resize((224, 224), resample=0) datafr.W = 224 img.save('some_image.png') number = number model = build_model(number) guided_model = build_guided_model(number) layer_name = '' modelNamesChoosen = '' if number == 1: layer_name = 'res5c_branch2c' modelNamesChoosen = "ResNet50" elif number == 0: layer_name = 'block5_conv3' modelNamesChoosen = "VGG16" elif number == 2: layer_name = 'normal_add_2_12' modelNamesChoosen = "NasNetMobile" elif number == 3: layer_name = 'conv_dw_13' modelNamesChoosen = "MobileNet" gradcam, gb, guided_gradcam, dictionaries = compute_saliency( model, guided_model, layer_name=layer_name, img_path=img, cls=-1, visualize=False, save=True, string=number, knob=knob) img1 = '' with open("assets/gradcam.jpg", "rb") as imageFile: img1 = base64.b64encode(imageFile.read()).decode("utf-8") img2 = '' with open("assets/guided_backprop.jpg", "rb") as imageFile: img2 = base64.b64encode(imageFile.read()).decode("utf-8") img3 = '' with open("assets/guided_gradcam.jpg", "rb") as imageFile: img3 = base64.b64encode(imageFile.read()).decode("utf-8") #print(datafr.d[0][1]) #ac=str(list(dictvariables[d])[0]) dictvariables = [] dictvariables.append(1) dictvariables.append(dictionaries) ## ## output = open('myfile.pkl', 'wb') ## pickle.dump(dictionaries, output) ## output.close() # Manipulate here print("Yes1", "\n\n") # You can write your python code or call a class/ function of ocr. # Your picked image will be stored as some_image.png locally. You can pick this image and manipulate. ''' working example img1='' with open("some_image.png", "rb") as imageFile: img1=base64.b64encode(imageFile.read()).decode("utf-8") Now you can send this encoded base64 string to model or convert it into numpy array. ''' ################################## ## img1='' ## with open("some_image.png", "rb") as imageFile: ## img1=base64.b64encode(imageFile.read()).decode("utf-8") # Lets say your output text here I'm taking as base64 string of image filename = "some_image.png" parser = createParser(filename) metadata = extractMetadata(parser) linestring = [] counterline = 0 print("yes2", "\n\n") for line in metadata.exportPlaintext(): if counterline == 0: linestring.append(html.Div([html.H5(line)])) counterline += 1 else: linestring.append(html.Div([html.P(line)])) #datafr.loader+=10 try: linestring = linestring.split("\n")[1:] linestring = "\n".join(linestring) except: pass print("YES3.1", "\n\n") ac = list(dictionaries)[0] print("YES3", "\n\n") originalcard = html.Div([ dbc.Card( [ dbc.CardBody([dbc.CardTitle(new_filename)]), dbc.CardImg( src=('data:image/png;base64,{}'.format(string))), dbc.CardBody([ dbc.CardText(html.P("Original Image")), ]), ], style={"max-width": "250px"}, ), ], className="twelve columns") cardgradcam = dbc.Card( [ dbc.CardBody([dbc.CardTitle("Gradcam")]), dbc.CardImg(src=('data:image/jpg;base64,{}'.format(img1))), dbc.CardBody([ dbc.CardText(ac), ]), ], style={"max-width": "250px"}, ) cardprop = dbc.Card( [ dbc.CardBody([dbc.CardTitle("Guided Backpropogation")]), dbc.CardImg(src=('data:image/jpg;base64,{}'.format(img2))), dbc.CardBody([ dbc.CardText(ac), ]), ], style={"max-width": "250px"}, ) cardguided = dbc.Card( [ dbc.CardBody([dbc.CardTitle("Guided Gradcam")]), dbc.CardImg(src=('data:image/jpg;base64,{}'.format(img3))), dbc.CardBody([ dbc.CardText(ac), ]), ], style={"max-width": "250px"}, ) ## org=[html.Div([html.Div([dbc.Card([ ## dbc.CardHeader("vizard \u2b50"), ## dbc.CardBody( ## [ html.Div([ ## html.Div([originalcard],className="five columns offset-by-one"), ## html.Div([ ## html.Div([html.Div(linestring),],className='eight columns'),],className="six columns"),],className='row'),]), ## ])],className="twelve columns"), ## dbc.Card([ ## dbc.CardHeader(str(labels)+" thinks that it is "+ ac), ## dbc.CardBody([html.Div([html.Div([ ## html.Div([ ## cardgradcam ## ],className="four columns"), ## html.Div([ ## cardprop ## ],className="four columns"), ## html.Div([ ## cardguided ## ],className="four columns"), ## ],className="row"), ## ],className="eleven columns offset-by-one",style={"margin-top":"10px","margin-bottom":"10px"}), ## ]),]), ## html.Div([ ## dbc.Card( ## [dbc.CardHeader("vizard \u2b50"), ## dbc.CardBody( ## [html.Div(""), ## ] ## ), ## ] ## ),],style={"margin-top":"10px","margin-":"10px"})])] ## print("Library Changed,\n\n") #print(org) x = [] y = [] title = "Probability For " + str(modelNamesChoosen) + " Model" for i in dictionaries: y.append(i) x.append(dictionaries[i][1]) fig = [ dcc.Graph(id='example-graph-1', figure={ 'data': [ { 'x': y, 'y': x, 'type': 'bar', 'name': 'Probability' }, ], 'layout': { 'title': title } }) ] return [ html.Div([ html.Div(id='lolo', children=[str(dictionaries)], style={'display': 'None'}), dbc.Card([ dbc.CardHeader("vizard \u2b50"), dbc.CardBody([ html.Div([ html.Div([originalcard], className="five columns offset-by-one"), html.Div([ html.Div([ html.Div(linestring), ], className='eight columns'), ], className="six columns"), ], className='row'), ]), ]) ], className="twelve columns"), dbc.Card([ dbc.CardHeader( str(modelNamesChoosen) + " thinks that it is " + ac), dbc.CardBody([ html.Div([ html.Div([ html.Div([cardgradcam], className="four columns"), html.Div([cardprop], className="four columns"), html.Div([cardguided], className="four columns"), ], className="row"), ], className="eleven columns offset-by-one", style={ "margin-top": "10px", "margin-": "10px" }), ]), ]), html.Div([ dbc.Card([ dbc.CardHeader("vizard \u2b50"), dbc.CardBody([ html.Div(fig), ]), ]), ], style={ "margin-top": "10px", "margin-": "10px" }) ]
"x": [1, 2, 3, 4], "y": [9, 4, 1, 4], "text": ["w", "x", "y", "z"], "customdata": ["c.w", "c.x", "c.y", "c.z"], "name": "Trace 2", "mode": "markers", "marker": { "size": 12 } }] }), html.Div(children=dbc.Row(children=[ dbc.Col(children=dbc.Card([ dbc.CardHeader("Hover Data"), dbc.CardBody([ dbc.CardText(html.Pre(id="hover-data")), ]), ])), dbc.Col(children=dbc.Card([ dbc.CardHeader("Click Data"), dbc.CardBody([ dbc.CardText(html.Pre(id="click-data")), ]), ])), dbc.Col(children=dbc.Card([ dbc.CardHeader("Selected Data"), dbc.CardBody([ dbc.CardText(html.Pre(id="selected-data")), ]), ])), dbc.Col(children=dbc.Card([
def update_graph_interactive_image(content, number, label, knob, dictvariables): if (content is not None): print(content) ## for i in label: ## if i['value']==number: ## dictvariables[label2]=i['label'] ## dictvariables[check]=0 #datafr.loader=0 #dictvariables[d]=dict() #dictvariables[predict]=knob #dictvariables[flags1]=1 img = Image.open('some_image.png') print(img) number = number print('-----------') print(dictvariables[0], type(dictvariables[0])) dictvariables = ast.literal_eval(dictvariables[0]) aa = dictvariables[content][0] model = build_model(number) guided_model = build_guided_model(number) modelNamesChoosen = '' if number == 1: layer_name = 'res5c_branch2c' modelNamesChoosen = "ResNet50" elif number == 0: layer_name = 'block5_conv3' modelNamesChoosen = "VGG16" elif number == 2: layer_name = 'normal_add_2_12' modelNamesChoosen = "NasNetMobile" elif number == 3: layer_name = 'conv_dw_13' modelNamesChoosen = "MobileNet" gradcam, gb, guided_gradcam, dictionaries = compute_saliency( model, guided_model, layer_name=layer_name, img_path=img, cls=aa, visualize=False, save=True, string=number, knob=knob) img1 = '' with open("assets/gradcam.jpg", "rb") as imageFile: img1 = base64.b64encode(imageFile.read()).decode("utf-8") img2 = '' with open("assets/guided_backprop.jpg", "rb") as imageFile: img2 = base64.b64encode(imageFile.read()).decode("utf-8") img3 = '' with open("assets/guided_gradcam.jpg", "rb") as imageFile: img3 = base64.b64encode(imageFile.read()).decode("utf-8") ac = content ## try: ## img_data = open('some_image.png', 'rb').read() ## msg = MIMEMultipart() ## msg['Subject'] = 'Keras Visualtion Tool Report' ## tempstring="The probability predicted by the "+datafr.label2+" model are"+str(datafr.d1) ## text = MIMEText(tempstring) ## msg.attach(text) ## image_data = MIMEImage(img_data, name=os.path.basename('some_image.png')) ## msg.attach(image_data) ## img_data = open('assets/gradcam.png', 'rb').read() ## image_data = MIMEImage(img_data, name=os.path.basename('assets/gradcam.png')) ## msg.attach(image_data) ## img_data = open('assets/guided_backprop.png', 'rb').read() ## image_data = MIMEImage(img_data, name=os.path.basename('assets/guided_backprop.png')) ## msg.attach(image_data) ## img_data = open('assets/guided_gradcam.png', 'rb').read() ## image_data = MIMEImage(img_data, name=os.path.basename('assets/guided_gradcam.png')) ## msg.attach(image_data) ## FROM = "*****@*****.**" ## TO = str(email).split(",") ## ## import smtplib ## try: ## server = smtplib.SMTP('smtp.gmail.com', 587) ## except: ## server = smtplib.SMTP('smtp.gmail.com', 465) ## server.starttls() ## server.login("#youremail", "#yourpassword") ## server.sendmail(FROM, TO, msg.as_string()) ## server.quit() ## except Exception as e: ## print('mail error'+str(e)) ##for firebase no need ''' imageBlob=bucket.blob("gradcam/"+'gradcam_'+datafr.label1+"_"+content+"_"+datafr.new_filename.split(".")[0]) imageBlob.upload_from_filename('assets/gradcam.jpg') imageBlob=bucket.blob("guided_backprop/"+'guided_backprop_'+"_"+datafr.label1+content+"_"+datafr.new_filename.split(".")[0]) imageBlob.upload_from_filename('assets/guided_backprop.jpg') imageBlob=bucket.blob("guided_gradcams/"+'guided_gradcam_'+"_"+datafr.label1+content+"_"+datafr.new_filename.split(".")[0]) imageBlob.upload_from_filename('assets/guided_gradcam.jpg') ''' ###datafr.loader+=10 cardgradcam = dbc.Card( [ dbc.CardBody([dbc.CardTitle("Gradcam")]), dbc.CardImg(src=('data:image/jpg;base64,{}'.format(img1))), dbc.CardBody([ dbc.CardText(ac), ]), ], style={"max-width": "250px"}, ) cardprop = dbc.Card( [ dbc.CardBody([dbc.CardTitle("Guided Backpropogation")]), dbc.CardImg(src=('data:image/jpg;base64,{}'.format(img2))), dbc.CardBody([ dbc.CardText(ac), ]), ], style={"max-width": "250px"}, ) cardguided = dbc.Card( [ dbc.CardBody([dbc.CardTitle("Guided Gradcam")]), dbc.CardImg(src=('data:image/jpg;base64,{}'.format(img3))), dbc.CardBody([ dbc.CardText(ac), ]), ], style={"max-width": "250px"}, ) #nnn = ToastNotifier() #datafr.loader+=10 #nnn.show_toast("vizard ", "Task is Completed", duration = 5, #icon_path ="assets/favicon.ico") #dictvariables[check]=1 x = [] y = [] title = "Probability For " + str(modelNamesChoosen) + " Model" for i in dictionaries: y.append(i) x.append(dictionaries[i][1]) fig = [ dcc.Graph(id='example-graph-2', figure={ 'data': [ { 'x': y, 'y': x, 'type': 'bar', 'name': 'Probability' }, ], 'layout': { 'title': title } }) ] return [ dbc.Card([ dbc.CardHeader( str(modelNamesChoosen) + " thinks that it is " + ac), dbc.CardBody([ html.Div([ html.Div([ html.Div([cardgradcam], className="four columns"), html.Div([cardprop], className="four columns"), html.Div([cardguided], className="four columns"), ], className="row"), ], className="eleven columns offset-by-one", style={ "margin-top": "10px", "margin-": "10px" }), ]), ]), html.Div([ dbc.Card([ dbc.CardHeader("vizard \u2b50"), dbc.CardBody([ html.Div(fig), ]), ]), ], style={ "margin-top": "10px", "margin-": "10px" }), ] return [ html.Div([ html.Div([cardgradcam]), html.Img(src='data:image/jpg;base64,{}'.format(img1)), html.Img(src='data:image/jpg;base64,{}'.format(img2)), html.Img(src='data:image/jpg;base64,{}'.format(img3)), ]) ] else: return [] return [ html.Div([ html.Img(src='data:image/jpg;base64,{}'.format(img1)), html.Img(src='data:image/jpg;base64,{}'.format(img2)), html.Img(src='data:image/jpg;base64,{}'.format(img3)), ]) ]
dbc.DropdownMenuItem(divider=True), dbc.DropdownMenuItem("Entry 3"), ], ), ], brand="Demo", brand_href="#", sticky="top", dark=True, ) # define content for page 1 page1 = dbc.Card( [ dbc.CardTitle("Page 1 contents"), dbc.CardText("You can replace this with whatever you like"), ], body=True, ) # define content for page 2 tab1 = dbc.Card( [ dbc.CardTitle("Page 2, tab 1 contents"), dbc.CardText("You can replace this with whatever you like"), ], body=True, ) tab2 = dbc.Card(
{"label": "Option 2", "value": 2}, ], value=1, inline=True), ], className="bg-light") checklist_inline = dbc.FormGroup(children=[ dbc.Label("Choose a bunch"), dbc.Checklist(options=[ {"label": "Option 1", "value": 1}, {"label": "Option 2", "value": 2}, ], values=[1, 2], inline=True), ], className="bg-light") # --------------------------------------------------------------------------------------- tab1_content = dbc.Card(children=dbc.CardBody([ dbc.CardText("This is tab 1!"), dbc.Button("Click here", color="success"), ]) ) tab2_content = dbc.Card(children=dbc.CardBody([ dbc.CardText("This is tab 2!"), dbc.Button("Don't click here", color="danger"), ]) ) def generate_table(dataframe, max_rows=10, size="md"): """ 创建表 """
#%% LAYOUT ############################################################ # ############################################################################### title = 'Checkout Analysis Dashboard' functionality_description = 'First iteration of Checkout Analyis Dashboard. Data is pulled hourly, and all dates/times are in UTC.' layout = html.Div([ dbc.Card([ dbc.CardHeader(title, style={'font-size': '2em'}), dbc.CardBody([ dbc.Button("Click here for more information on this dashboard", id="collapse_button_o", className="mb-3"), dbc.Collapse( [dbc.CardText([ html.P(children=functionality_description), ])], id='collapse_o', is_open=False) ]) ]), dbc.Tabs([ dbc.Tab([ dbc.Row([ dbc.Col( [ html.P(children='Frequency:'), dcc.Dropdown(id='frequency_dropdown_state_ca', options=[{ 'label': 'Day', 'value': 'day'
} card = 'https://metabase.ubiome.io/api/card/{0}/query/json'.format(card_id) data = requests.post(card, headers=get_header) data_df = pd.DataFrame(data.json()) return (data_df.to_json(orient='split')) description = "This dashboard is focused on delivering product analytics for marketing experiments" topcard = dbc.Card([ dbc.CardHeader("uBiome Marketing Experiments Dashboard", style={'font_size': '2em'}), dbc.CardBody( [dbc.CardTitle("How to use"), dbc.CardText(dcc.Markdown(description))]) ], className="mt-4") experiment_map = [{ 'exp_name': 'Remove S&H', 'Product': 'SmartGut', 'exp_id': 'FOqgdaAZTpmzBv8TH_IHPA' }, { 'exp_name': 'Remove S&H', 'Product': 'SmartJane', 'exp_id': 'KJ_Up-AXRgWtBqjBbZNkAQ' }, { "exp_name": "Assume Cashpay", 'Product': 'SmartGut', 'exp_id': "4zEazw-US3C53kCrBsKw_A" }, {