def get_comment_collapse(system):
    return html.Div(children=[
        button(
            'Opmerking toevoegen',
            'toggle_comment_' + system,
            backgroundcolor=site_colors['indigo'],
        ),
        html.Br(),
        dbc.Collapse(dbc.Card([
            dbc.Textarea(
                id='textarea_comment_' + system,
                className='mb-3',
                placeholder="Vul je opmerking in",
            ),
            button('Opmerking opslaan',
                   'commit_comment_' + system,
                   backgroundcolor=site_colors['indigo'])
        ],
                              body=True,
                              style={
                                  'backgroundColor': site_colors['grey20'],
                              }),
                     id='collapse_comment_' + system)
    ],
                    style={
                        "textAlign": "left",
                    })
Exemplo n.º 2
0
def panel_gdrive(msg=None, n_clicks=None):
    r = [
        html.H4(className='mdl-card__title-text',
                children='Google Drive',
                style={
                    'font-size': '24px',
                    'margin-bottom': '16px',
                    'color': 'white'
                }),
        dbc.Textarea(placeholder="Pegar Código del Token",
                     id='code_input',
                     value=msg,
                     style={
                         'outline-color': 'var(--accent_d)',
                         'color': 'var(--primary_d)',
                         'min-height': '40px'
                     }),
        html.Div(style={'margin-top': '16px'},
                 children=[
                     html.A('ACCEDER',
                            className='mdl-button',
                            style={'color': 'white'},
                            target='_blank',
                            id='get_code'),
                     html.A('AUTENTICAR',
                            className='mdl-button',
                            style={'color': 'white'},
                            n_clicks=n_clicks,
                            id='set_code'),
                 ])
    ]

    return (r)
Exemplo n.º 3
0
def get_config_body(product):
    return dbc.Textarea(bs_size='sm',
                        id=f'area-config-{product}',
                        style={
                            'width': WIDTH,
                            'height': '300px'
                        })
Exemplo n.º 4
0
def get_create_style_components():
    style_components = [
        html.H3("Styles"),
        html.A(
            children="Style Reference",
            href="https://js.cytoscape.org/#style",
            target="_blank",
        ),
        dbc.Input(
            id=id_constants.STYLE_NAME_INPUT,
            type="text",
            placeholder="Style Name",
        ),
        dbc.Textarea(id=id_constants.STYLE_TEXTAREA),
        dbc.Button(
            id=id_constants.LOAD_STYLE_TEXTAREA_BUTTON,
            children="Load Style",
        ),
        dbc.Button(
            id=id_constants.SAVE_STYLE_TEXTAREA_BUTTON,
            children="Save Style",
        ),
        dbc.Button(
            id=id_constants.DELETE_STYLE_BUTTON,
            children="Delete Style",
        ),
        dbc.Toast(
            id=id_constants.SAVE_STYLE_TOAST,
            duration=3000,
            dismissable=True,
            body_style={"display": "none"},
            is_open=False,
        ),
    ]
    return style_components
Exemplo n.º 5
0
def create_app_ui():
    global project_name
    main_layout = dbc.Container(
        dbc.Jumbotron(
                [
                    html.H1(id = 'heading', children = project_name, className = 'display-3 mb-4'),
                    
                    html.Div(className='mat-card', 
                             style={"display": "block", "margin": "15px"},
                             children=[html.H4(children='Sentiment Pie Chart'),
                                       dcc.Graph(figure=pie_fig)]
                             ),
                    
                    dbc.Container([
                        dcc.Dropdown(
                    id='dropdown',
                    placeholder = 'Select a Review',
                    options=[{'label': i[:100] + "...", 'value': i} for i in scrappedReviews.reviews],
                    value = scrappedReviews.reviews[0],
                    style = {'margin-bottom': '30px'}
                    )],
                        style = {'padding-left': '50px', 'padding-right': '50px'}
                        ),
                    dbc.Button("Submit", color="dark", className="mt-2 mb-3", id = 'button', style = {'width': '100px'}),
                    html.Div(id = 'result'),
                    dbc.Textarea(id = 'textarea', className="mb-3", placeholder="Enter the Review", value = 'Enter your text..', style = {'height': '150px'}),
                    dbc.Button("Submit", color="dark", className="mt-2 mb-4", id = 'button1', style = {'width': '100px'}),
                    html.Div(id = 'result1')
                    ],
                className = 'text-center'
                ),
        className = 'mt-4'
        )
    
    return main_layout
Exemplo n.º 6
0
def get_comment_components(initial_value=""):
    """Generates a list of components for use in comment related interactions.

    We let the id fields be dictionaries here, to prevent Dash errors
    when registering callbacks to dynamically created components.
    Although we can directly assign an id and register a callback,
    an error appears in the Dash app saying that no such ID exists.
    The callback still works despite the error.
    It can be supressed, but only at a global granularity (for all callbacks),
    which seems too heavy handed.

    Instead, we use the pattern matching callback feature to
    match the dictionary fields in the id.
    This is the same approach taken in update_graph_elements to
    register the callback from the client datatable.

    Notice that the value of the dictionary doesn't matter,
    since we keep the key unique and match the value with ALL.
    Unfortunately, we can't do something like id={"id": "component-unique-id"},
    and match with Output/Input/State({"id": "component-unique-id"})
    since the callback requires a wildcard (ALL/MATCH) to match.
    We have to add an unused field, such as
    id={"id": "component-unique-id", "index": 0} and match with
    Output/Input/State({"id": "component-unique-id", "index": ALL/MATCH})
    Neither solution is ideal, but have to work with it.

    Returns:
        A list of Dash components.
    """

    comment_components = [
        html.H3("Comments"),
        dbc.Textarea(
            id={id_constants.NODE_COMMENT_TEXTAREA: id_constants.NODE_COMMENT_TEXTAREA},
            value=initial_value,
        ),
        dbc.Button(
            id={
                id_constants.SAVE_COMMENT_TEXTAREA_BUTTON: id_constants.SAVE_COMMENT_TEXTAREA_BUTTON
            },
            children="Save Comment",
        ),
        dbc.Button(
            id={
                id_constants.DISCARD_COMMENT_TEXTAREA_BUTTON: id_constants.DISCARD_COMMENT_TEXTAREA_BUTTON
            },
            children="Discard Comment Changes",
        ),
        dbc.Toast(
            id={id_constants.SAVE_COMMENT_TOAST: id_constants.SAVE_COMMENT_TOAST},
            header="Successfully saved comment!",
            icon="success",
            duration=3000,
            dismissable=True,
            body_style={"display": "none"},
            is_open=False,
        ),
    ]
    return comment_components
Exemplo n.º 7
0
def NamedText(name, type="number", **kwargs):
    return html.Div(
        children=[
            html.P(children=f"{name}:"),
            dbc.Textarea(**kwargs)
            # dcc.Input(type="number", debounce=True, **kwargs),
        ],
    )
Exemplo n.º 8
0
def get_layout(**kwargs):
    initial_text = kwargs.get("text", "Type some text into me!")

    # Note that if you need to access multiple values of an argument, you can
    # use args.getlist("param")
    return html.Div([
        dcc.Markdown(
            dedent("""
                    # Character Counter
                    
                    This demo counts the number of characters in the text box and
                    updates a bar chart with their frequency as you type.
                    """)),
        dbc.FormGroup(
            dbc.Textarea(
                id="text-input",
                value=initial_text,
                style={
                    "width": "40em",
                    "height": "5em"
                },
            )),
        dbc.FormGroup([
            dbc.Label("Sort by:"),
            dbc.RadioItems(
                id="sort-type",
                options=[
                    {
                        "label": "Frequency",
                        "value": "frequency"
                    },
                    {
                        "label": "Character code",
                        "value": "code"
                    },
                ],
                value="frequency",
            ),
        ]),
        dbc.FormGroup([
            dbc.Label("Normalize character case?"),
            dbc.RadioItems(
                id="normalize",
                options=[
                    {
                        "label": "No",
                        "value": "no"
                    },
                    {
                        "label": "Yes",
                        "value": "yes"
                    },
                ],
                value="no",
            ),
        ]),
        dcc.Graph(id="graph"),
    ])
Exemplo n.º 9
0
def description():
    """Sample Description"""
    label = dbc.FormText("Description")
    field = dbc.Textarea(
        value="",
        placeholder="Add description",
        id="info-description-edit",
        style={"height": "12rem"},
    )
    return [label, field]
Exemplo n.º 10
0
 def callback_elements(cls):
     ''' List of DOM elements that will be manipulated by
         callbacks in the main app, to pass layout validation
     '''
     return [
         daq.BooleanSwitch(id='goal-completion-toggle'),
         dbc.Button(id='edit-notes'),
         dbc.Button(id='submit-notes'),
         dbc.Textarea(id='notes-content')
     ]
Exemplo n.º 11
0
 def editable_notes(notes):
     form_children = []
     if notes:
         form_children.append(
             dbc.FormGroup(
                 dbc.Textarea(className='markdown',
                              id='notes-content',
                              value=notes,
                              style={'min-height': 250})))
     else:
         form_children.append(
             dbc.FormGroup(
                 dbc.Textarea(
                     className='markdown',
                     id='notes-content',
                     placeholder='Write notes here in markdown format...',
                     style={'min-height': 250})))
     form_children.append(
         dbc.Button("Save", id="submit-notes", color="primary"))
     return dbc.Form(form_children)
Exemplo n.º 12
0
def create_app_ui():
    global project_name
    main_layout = dbc.Container(
        dbc.Jumbotron(
                [
                    html.H1(id = 'heading', children = project_name,className = 'display-3 mb-4'),
                    html.Br(),
                    html.Div([
            html.Img(src = app.get_asset_url('Sentiment-analysis.png'))
        ], style={'textAlign': 'center'}),
                    html.Br(),
                    html.Br(),
                    html.H2(id= 'pichart',children = 'Pie Chart', className = 'piechart-1'),
                    dcc.Graph(figure = pie_c()),
                    html.H2(id= 'positivewords',children = 'Positive words', className = 'wordcloud-1'),
                    html.Div([
            html.Img(src = app.get_asset_url('posword.png'))
        ], style={'textAlign': 'center'}),
                    html.Br(),
                    html.H2(id= 'negativewords',children = 'Negative words', className = 'wordcloud-2'),
                    html.Div([
            html.Img(src = app.get_asset_url('negword.png'))
        ], style={'textAlign': 'center'}),
                    html.Br(),
                    
                    html.H2(id= 'reviewentry',children = 'Type your Review', className = 'reviewtype-1'),
                    dbc.Textarea(id = 'textarea', className="mb-3", placeholder="Enter the Review", value='This ia a good product',style = {'height': '150px'}),
                    html.Br(),
                    
                    html.H2(id= 'reviewdropdown',children = 'Choose a review from below', className = 'reviewtype-2'),
                    dbc.Container([
                        dcc.Dropdown(
                    id='dropdown',
                    placeholder = 'Select a Review',
                    options=[{'label': i[:100] + "...", 'value': i} for i in scrappedReviews.reviews],
                    value = scrappedReviews.reviews[0],
                    style = {'margin-bottom': '30px'}
                )
                       ],
                        style = {'padding-left': '50px', 'padding-right': '50px'}
                        ),
                    dbc.Button("Submit", color="dark", className="mt-2 mb-3", id = 'button', style = {'width': '100px'}),
                    html.Div(id = 'result'),
                    html.Div(id = 'result1')
                    ],
                className = 'text-center'
                ),
        className = 'mt-4'
        )
    
    return main_layout
Exemplo n.º 13
0
def create_app_ui():
    global project_name
    global df
    df = df.dropna()
    df = df[df['overall'] != 3]
    df['Positivity'] = np.where(df['overall'] > 3, 1, 0)
    labels = ['Positive Reviews', 'Negative Reviews']
    values = [len(df[df.Positivity == 1]), len(df[df.Positivity == 0])]
    main_layout = dbc.Container(dbc.Jumbotron([
        html.H1(
            id='heading', children=project_name, className='display-3 mb-4'),
        dbc.Container(dcc.Loading(
            dcc.Graph(
                figure={
                    'data': [go.Pie(labels=labels, values=values)],
                    'layout': go.Layout(height=600, width=1000, autosize=False)
                })),
                      className='d-flex justify-content-center'),
        html.Hr(),
        dbc.Textarea(id='textarea',
                     className="mb-3",
                     placeholder="Enter the Review",
                     value='My daughter loves these shoes',
                     style={'height': '150px'}),
        html.Hr(),
        dbc.Container([
            dcc.Dropdown(id='dropdown',
                         placeholder='Select a Review',
                         options=[{
                             'label': i[:100] + "...",
                             'value': i
                         } for i in df.reviewText.sample(50)],
                         value=df.reviewText[0],
                         style={'margin-bottom': '30px'})
        ],
                      style={
                          'padding-left': '50px',
                          'padding-right': '50px'
                      }),
        dbc.Button("Submit",
                   color="dark",
                   className="mt-2 mb-3",
                   id='button',
                   style={'width': '100px'}),
        html.Div(id='result'),
        html.Div(id='result1')
    ],
                                              className='text-center'),
                                className='mt-4')
    return main_layout
Exemplo n.º 14
0
def create_app_ui():
    global project_name
    main_layout = dbc.Container(dbc.Jumbotron([
        html.H1(
            id='heading', children=project_name, className='display-4 mb-5'),
        dbc.Container([dcc.Graph(figure=fig)],
                      style={
                          'margin-bottom': '30px',
                          'margin-top': '30px'
                      }),
        dbc.Container([
            dcc.Dropdown(id='dropdown',
                         placeholder='Select a Review',
                         options=[{
                             'label': i[:100] + "...",
                             'value': i
                         } for i in scrappedReviews],
                         value=scrappedReviews[0],
                         style={'margin-bottom': '30px'})
        ],
                      style={
                          'padding-left': '50px',
                          'padding-right': '50px'
                      }),
        dbc.Button("Check",
                   color="dark",
                   className="mb-3",
                   id='button',
                   style={'width': '100px'}),
        html.Div(id='result1'),
        dbc.Textarea(id='textarea',
                     className="mb-3",
                     placeholder="Enter the Review",
                     value='I love these earrings',
                     style={
                         'height': '150px',
                         'margin-top': '30px'
                     }),
        dbc.Button("Check",
                   color="dark",
                   className="mt-2 mb-3",
                   id='button1',
                   style={'width': '100px'}),
        html.Div(id='result')
    ],
                                              className='text-center'),
                                className='mt-4')

    return main_layout
Exemplo n.º 15
0
def display_input_tab():
    content = dbc.Card(
        dbc.CardBody([
            dbc.Textarea(
                id="textarea",
                placeholder="Input your text for NER",
                style={
                    "width": "100%",
                    "height": 150
                },
            ),
        ]),
        className="card border-primary mb-3",
    )
    return content
Exemplo n.º 16
0
def contact_layout():
    '''This is the screen layout to send us an email.'''
    return html.Div([
    html.Br(),
    dbc.Label('Name:'),
    dbc.Input(
        type = 'value',
        id = 'name',
        minLength = 3,
        maxLength = 100,
        valid = True,
        style = {'width': 400},
    ),

    dbc.Label('Email address:'),
    dbc.Input(
        type = 'email',
        id='email-addr',
        minLength = 7,
        maxLength = 30,
        valid = True,
        style = {'width': 400}
    ),

    html.Br(),
    html.Br(),
    dbc.Label('Please type your comment below:'),
    html.Br(),
    dbc.Label('Minimum 10 characters, maximum 500 characters'),
    dbc.Textarea(
        id = 'comment',
        maxLength = 500,
        required = True,
        rows = 6,
        spellCheck = True,
        valid = True
    ),

    html.Br(),
    dbc.Button('Submit',
        id = 'submit-email',
        color = 'primary',
        n_clicks = 0,
        className='mr-2'
    ), html.Div(id = 'email_to'),
])
Exemplo n.º 17
0
def text_area_form(question, s_range=None, app=None):
    form_id = "_".join(question.lower().split(" "))
    main_input = dbc.FormGroup([
        dbc.Label(question, html_for="entry-form"),
        dbc.Textarea(
            # type="question",
            id=form_id,
            value="Your cool thoughts come here ...",
            style={"height": 50},
        ),
        dbc.FormText(
            "Use #tags for specific words",
            color="secondary",
        ),
    ])

    return main_input
Exemplo n.º 18
0
def get_blog_post_layout():
    post_input = dbc.FormGroup([
        dbc.Label("Markdown Blog Post", html_for="txt_blog_post"),
        dbc.Textarea(id="txt_blog_post",
                     placeholder="Enter a markdown format text",
                     rows=10),
        dbc.Button("Save", id="btn_save", className="mr-2"),
    ])

    result = html.Div(children=[
        html.Div([html.Br(), post_input]),
        html.Div(children=get_all_posts(),
                 id="div_accordion",
                 className="accordion")
    ])

    return result
Exemplo n.º 19
0
def more_settings_modal():
    """More settings features modal for min, max and expr"""
    head = dbc.ModalHeader(
        [html.Div("More Options"),
         html.Div("", id="features-modal-subtitle")])
    body = dbc.ModalBody([
        html.Div([
            "Minimum",
            dcc.Input(value=None, type="number", id="features-modal-min"),
        ]),
        html.Div([
            "Maximum",
            dcc.Input(value=None, type="number", id="features-modal-max"),
        ]),
        html.Div(
            ["Expression",
             dbc.Textarea(value=None, id="features-modal-expr")]),
    ])
    foot = dbc.ModalFooter(dbc.Button("Save", id="features-modal-save"))

    return dbc.Modal([head, body, foot], id="features-modal", is_open=False)
Exemplo n.º 20
0
def make_one_question_form(app, sql_connect):
    main_input = dbc.FormGroup(
        [
            dbc.Label("Write here", html_for="entry-form"),
            dbc.Textarea(
                # type="question",
                id="question-form",
                value="Your cool thoughts come here ...",
                style={"height": 300},
            ),
            dbc.FormText(
                "Use #tags for specific words",
                color="secondary",
            ),
        ]
    )

    form = dbc.Form(
        [
            main_input,
            dbc.Button(
                "Submit", id="question-button", color="primary", n_clicks=0
            ),
        ],
    )

    @app.callback(
        Output("question-form", "value"),
        Input("question-button", "n_clicks"),
        State("question-form", "value"),
    )
    def update_output(n_clicks, value):
        if n_clicks > 0:
            write(sql_connect, value)

            return "You have entered: \n{}".format(value)

    return form
Exemplo n.º 21
0
def update_text_areas(store_s: str, n_clicks, raw_transcript, new_name,
                      asr_model):
    store_data = get_store_data(store_s)
    print(f"store-data: {[asdict(v) for v in store_data.values()]}")

    if "spoken" in store_data.keys():
        transcripts = list(store_data.values())
    elif raw_transcript is not None:
        transcripts = [TranslatedTranscript("spoken", 0, raw_transcript)]
    else:
        print(f"DEBUG: not updating text_areas")
        raise PreventUpdate

    if new_name is not None and new_name != NO_NAME:
        transcripts.append(
            TranslatedTranscript(new_name, len(transcripts),
                                 "enter text here"))

    rows = []
    for sd in sorted(transcripts, key=lambda x: x.order):
        rows.append(dbc.Row(html.H5(sd.name)))
        rows.append(
            dbc.Row(
                dbc.Textarea(
                    title=sd.name,
                    id={
                        "type": "transcript-text",
                        "name": sd.name
                    },
                    value=sd.text,
                    style={
                        "width": "90%",
                        "height": 200,
                        "fontSize": 11
                    },
                )))
    return rows
Exemplo n.º 22
0
def run_script_onClick(n_clicks, filename, contents):
    # Don't run unless the button has been pressed...
    if not n_clicks:
        raise PreventUpdate

    # Load your output file with "some code"
    #global compression
    #compression = compressor(PATH_TO_OD_LABELS=f"{home_path}\\Documents\\GitHub\\aicompression\\models\\object_detection\\labels", PATH_TO_OD_MODEL_DIR=f"{home_path}\\Documents\\GitHub\\aicompression\\models\\object_detection")

    #PIL image with retrieved background
    img = Image.fromarray(compression.image_np)
    text_boxes = compression.perform_ocr()
    fig = [dbc.Row(id='text_box_0')]
    for i in range(len(text_boxes)):
        box = text_boxes[i].get("box")
        box_crop = (box[1], box[0], box[3], box[2])
        #crop = img[box[1]:box[3], box[0]:box[2]]
        img_cropped = img.crop(box_crop)
        text = text_boxes[i].get("text")
        if len(text.replace(" ", "")) > 0:
            fig.append(
                dbc.Row([
                    dbc.Col(html.Img(src=img_cropped,
                                     id='text_box_' + str(i + 1),
                                     style={'height': '50%'}),
                            width=7),
                    dbc.Col(dbc.Textarea(
                        id='text_' + str(i + 1),
                        placeholder=text,
                        className=
                        "text-center text-light font-weight-light, mb-4 h-50"),
                            width=5)
                ]))
        #ax.text(3, 8, text, style='italic',
        #bbox={'facecolor': 'red', 'alpha': 0.5, 'pad': 10})
    return fig
    def create_app_ui(self):
        self.balanced_reviews = self.balanced_reviews.dropna()
        # df = df[df['overall'] != 3]
        self.balanced_reviews['Positivity'] = np.where(
            self.balanced_reviews['overall'] > 3, 1, 0)
        labels = ['Positive Reviews', 'Negative Reviews', 'Neutral Reviews']
        values = [
            self.balanced_reviews[
                self.balanced_reviews.overall > 3].dropna().shape[0],
            self.balanced_reviews[
                self.balanced_reviews.overall < 3].dropna().shape[0],
            self.balanced_reviews[self.balanced_reviews.overall ==
                                  3].dropna().shape[0]
        ]

        labels1 = ['+ve Reviews', '-ve Reviews']
        values1 = [
            len(self.balanced_reviews[self.balanced_reviews.Positivity == 1]),
            len(self.balanced_reviews[self.balanced_reviews.Positivity == 0])
        ]

        colors = ['#00cd00', '#d80000', '#a6a6a6']

        main_layout = dbc.Container(dbc.Jumbotron([
            html.H1(id='heading1',
                    children='Sentiment Analysis with Insights',
                    className='display-3 mb-4',
                    style={
                        'font': 'sans-seriff',
                        'font-weight': 'bold',
                        'font-size': '50px',
                        'color': 'black'
                    }),
            html.P(id='heading5',
                   children='Distribution of reviews based on filtered data',
                   className='display-3 mb-4',
                   style={
                       'font': 'sans-seriff',
                       'font-weight': 'bold',
                       'font-size': '30px',
                       'color': 'black'
                   }),
            dbc.Container(dcc.Loading(
                dcc.Graph(
                    figure={
                        'data': [
                            go.Pie(labels=labels,
                                   values=values,
                                   hole=.3,
                                   pull=[0.2, 0, 0],
                                   textinfo='value',
                                   marker=dict(colors=colors,
                                               line=dict(color='#000000',
                                                         width=2)))
                        ],
                        'layout':
                        go.Layout(height=600, width=1000, autosize=False)
                    })),
                          className='d-flex justify-content-center'),
            html.Hr(),
            html.P(id='heading4',
                   children='The Positivity Measure',
                   className='display-3 mb-4',
                   style={
                       'font': 'sans-seriff',
                       'font-weight': 'bold',
                       'font-size': '30px',
                       'color': 'black'
                   }),
            dbc.Container(
                dcc.Loading(
                    dcc.Graph(id='example-graph',
                              figure={
                                  'data': [
                                      go.Bar(y=labels1,
                                             x=values1,
                                             orientation='h',
                                             marker=dict(color="MediumPurple"))
                                  ],
                                  'layout':
                                  go.Layout(xaxis={'title': 'Sentiments'},
                                            yaxis={'title': 'Emotions'}),
                              })), ),
            html.Hr(),
            html.P(id='heading2',
                   children='Feel as you type!',
                   className='display-3 mb-4',
                   style={
                       'font': 'sans-seriff',
                       'font-weight': 'bold',
                       'font-size': '30px',
                       'color': 'black'
                   }),
            dbc.Textarea(id='textarea',
                         className="mb-3",
                         placeholder="Enter a review",
                         value='',
                         style={'resize': 'none'}),
            html.Div(id='result'),
            html.Hr(),
            html.P(id='heading3',
                   children='Scrapped Etsy Review Sentiments',
                   className='display-3 mb-4',
                   style={
                       'font': 'sans-serif',
                       'font-weight': 'bold',
                       'font-size': '30px',
                       'color': 'black'
                   }),
            dbc.Container([
                dcc.Dropdown(id='dropdown',
                             placeholder='See what people think',
                             options=[{
                                 'label': i[:100] + "...",
                                 'value': i
                             } for i in self.scrapped_reviews.reviews],
                             value=self.balanced_reviews.reviewText[0],
                             style={'margin': '10px'})
            ]),
            html.Div(id='result1')
        ],
                                                  className='text-center'),
                                    className='mt-4')
        return main_layout
Exemplo n.º 24
0
def home_page_layout(data=None):
    if data is None:
        data = {'isadmin': False, 'logged_in': False, 'login_user': None}

    if data['logged_in']:
        # If you are the application admin show the log window otherwise leave it hidden
        if data['login_user'] == site_admin:
            log_display = 'grid'
        else:
            log_display = 'none'
    else:
        log_display = 'none'

    content = html.Div(
        html.Content([
            dbc.Row([
                # Log contents display
                dbc.Col(dbc.Card([
                    dbc.CardHeader(
                        html.H5('Log Output', className='card-title')),
                    dcc.Textarea(id='log-output',
                                 value=read_logfile(),
                                 readOnly=True,
                                 wrap='wrap')
                ]),
                        style={'display': log_display}),
                # Site admin controls
                dbc.Col(
                    dbc.Card([
                        dbc.CardHeader(
                            html.H5('Site Admin Controls',
                                    className='card-title')),
                        dbc.CardBody(
                            # id='site_admin_controls')
                            id='site-admin-card',
                            children=[
                                dcc.Tabs(
                                    id='site-admin-tabs',
                                    value='current_admins_list',
                                    children=[
                                        dcc.Tab(label='Current Admins',
                                                value='current_admins_list',
                                                style={
                                                    'border-radius':
                                                    '15px 0px 0px 0px'
                                                }),
                                        dcc.Tab(label='Edit Admins',
                                                value='site_admin_controls',
                                                style={
                                                    'border-radius':
                                                    '0px 15px 0px 0px'
                                                })
                                    ],
                                ),
                                html.Div(children=[
                                    dcc.Loading(id='site-admin-tabs-content',
                                                type='default')
                                ])
                            ])
                    ]),
                    style={
                        'display': log_display,
                        'maxWidth': '500px',
                        'maxHeight': '32.5vh'
                    },
                ),
            ]),
            dbc.Row([
                # In Development Features Column
                dbc.Col(dbc.Card([
                    dbc.CardHeader(
                        html.H5('Features in Development',
                                className='card-title')),
                    dbc.CardBody(read_upcoming_features())
                ]),
                        xl=4,
                        md=6,
                        width=12),
                # Implemented Features Column
                dbc.Col(dbc.Card([
                    dbc.CardHeader(
                        html.H5('Implemented Features',
                                className='card-title')),
                    dbc.CardBody(read_active_features())
                ]),
                        xl=4,
                        md=6,
                        width=12),
                # User Submission Form Column
                dbc.Col(
                    [
                        html.Div(
                            [
                                dbc.Form([
                                    html.H2('User Submission Form',
                                            style={'text-align': 'center'}),
                                    # Email input field
                                    dbc.FormGroup([
                                        dbc.Label('Email:', width=2),
                                        dbc.Col(dbc.Input(
                                            id='from_addr',
                                            type='email',
                                            placeholder=
                                            'Enter your L3Harris email address',
                                            value=''),
                                                width=10),
                                        dbc.FormFeedback(valid=True),
                                        dbc.FormFeedback(valid=False)
                                    ],
                                                  row=True),
                                    dbc.FormGroup(
                                        [
                                            dbc.Label('Choose one', width=4),
                                            dbc.Col(dbc.Select(
                                                options=[{
                                                    'label': 'Report a Bug',
                                                    'value': '1'
                                                }, {
                                                    'label': 'Feature Request',
                                                    'value': '2'
                                                }, {
                                                    'label': 'Request Admin',
                                                    'value': '3'
                                                }],
                                                id='msgType',
                                                value=1),
                                                    width=8)
                                        ],
                                        row=True),
                                    dbc.FormGroup([
                                        dbc.Textarea(
                                            id='body',
                                            bs_size='lg',
                                            placeholder=
                                            'Enter comments/suggestions',
                                            style={'height': '200px'},
                                            value='')
                                    ]),
                                    dbc.FormGroup([
                                        html.Div(
                                            '0',
                                            id='reset-div',
                                            style={'visibility': 'hidden'}),
                                        dbc.Button('Submit',
                                                   id='submit',
                                                   n_clicks=0,
                                                   size='lg',
                                                   color='success',
                                                   style={'width': '100px'}),
                                        dbc.Button('Reset',
                                                   id='reset',
                                                   n_clicks=0,
                                                   size='lg',
                                                   color='danger',
                                                   style={
                                                       'width': '100px',
                                                       'float': 'right'
                                                   })
                                    ]),
                                ]),
                                html.Div(id='output-state', children=[''])
                            ],
                            id='submission-form')
                    ],
                    xl={
                        'size': 4,
                        'offset': 0
                    },
                    md={
                        'size': 8,
                        'offset': 2
                    },
                    width=12)
            ])
        ]))
    return content
Exemplo n.º 25
0
                    style={
                        'width': '100%',
                        'height': '500px',
                        'overflowY': 'scroll',
                        'padding-top': '25px',
                        'padding-bottom': '25px'
                    })
            ],
            justify="center"),
        id=collapse1ID,
        is_open=True),
    html.Br(),

    # SQL entry
    dbc.Collapse(dbc.Row(
        [dbc.Textarea(id=sqlInputID, placeholder="Enter SQL...")]),
                 id=collapse2ID,
                 is_open=True),

    # html.Br(),
    # html.Div([
    #     html.Div(dcc.Dropdown(
    #         id=groupDropdownComponentID, value='phenotype', clearable=False,
    #         options=[{'label': x, 'value': x} for x in clinicalGroupList],
    #         multi=False,
    #         searchable=True,
    #         placeholder='Select one',
    #         style={"width": "90%"}
    #     ), className='two columns', style={"width": "15rem"}),
    #
    #     html.Div(dcc.Dropdown(
Exemplo n.º 26
0
                )),
        ],
                navbar=True)
    ],
    color="light",
    dark=False,
    sticky="top",
)

DASHBOARD = [
    dcc.Location(id='url', refresh=False),
    dbc.CardHeader(html.H5("NP Classifier")),
    dbc.CardBody([
        html.Div(id='version', children="Version - 1.4"),
        dbc.Textarea(className="mb-3",
                     id='smiles_string',
                     placeholder="Smiles Structure"),
        dcc.Loading(
            id="structure",
            children=[html.Div([html.Div(id="loading-output-5")])],
            type="default",
        ),
        dcc.Loading(
            id="classification_table",
            children=[html.Div([html.Div(id="loading-output-3")])],
            type="default",
        )
    ])
]

BODY = dbc.Container(
                     width=3)
         ],
         row=True,
     ),
 ],
          style=NONE,
          id='form'),
 html.Div(children=[
     html.P([
         'Edit your Stream configuration file. See the ',
         html.A('documentation', href=STREAM_DOCS_LINK, target='_blank'),
         ' for details.'
     ]),
     dbc.Textarea(bs_size='sm',
                  id='area-config',
                  style={
                      'width': '74.5%',
                      'height': '300px'
                  }),
     html.
     P(children='', style={'color': 'red'}, className='mb-0',
       id='p-status'),
     dbc.Card([
         dbc.CardBody([
             html.
             H5('You can now start Stream. Open a terminal and type the command below. You can save this command for future use.',
                className='card-title'),
             html.P(className='card-text', id='command'),
             html.Button('copy to clipboard',
                         id='copy',
                         **{'data-clipboard-target': '#command'},
                         className='btn btn-sm btn-warning',
Exemplo n.º 28
0
from stanfordcorenlp import StanfordCoreNLP
import json
from json2html import *

from collections import defaultdict

app = dash.Dash(__name__)  #external_stylesheets=[dbc.themes.SUPERHERO]

appserver = app.server

graph_card = dbc.Card([
    dbc.CardBody([
        dbc.Textarea(
            id='textzone',
            value='',
            bs_size="lg",
            className="mb-3",
            placeholder=
            "Please inter a statement in proper grammar with all implied clauses."
        ),
    ])
])

app.layout = html.Div([
    html.Br(),
    html.Br(),
    html.Br(),
    html.Br(),
    dbc.Row([html.H1('Machine Learning & Ontology Software')],
            justify="around"),
    html.Br(),
    html.Br(),
Exemplo n.º 29
0
                className='mb-3'),
 dbc.InputGroup([
     dbc.Input(placeholder="Recipient's username"),
     dbc.InputGroupAddon("@example.com", addon_type="append"),
 ],
                className='mb-3'),
 dbc.InputGroup([
     dbc.InputGroupAddon('$', addon_type='prepend'),
     dbc.Input(placeholder='Amount', type='number'),
     dbc.InputGroupAddon('.00', addon_type='append'),
 ],
                className='mb-3'),
 dbc.InputGroup(
     [
         dbc.InputGroupAddon("With textarea", addon_type="prepend"),
         dbc.Textarea(),
     ],
     className="mb-3",
 ),
 dbc.InputGroup([
     dbc.Select(options=[
         {
             "label": "Option 1",
             "value": 1
         },
         {
             "label": "Option 2",
             "value": 2
         },
     ]),
     dbc.InputGroupAddon("With select", addon_type="append"),
Exemplo n.º 30
0
            'label': 'Sphere',
            'value': 'sphere'
        }],
        placeholder="Style",
    )
]
vis_buttion_tx = dbc.Button('Visualise Transplant',
                            id='submit-tx-show',
                            n_clicks=0)
vis_buttion_epitope = dbc.Button('Visualise Epitopes',
                                 id='submit-ep-show',
                                 n_clicks=0)
text_area = [
    html.H6('By Epitopes'),
    dbc.Textarea(id='input-textarea',
                 bs_size='md',
                 className="mb-3",
                 placeholder="Epitopes for visualisation")
]
Tx_vis_card = dbc.Card([
    dbc.CardHeader(html.H5('3D Visualisation:', className="card-title")),
    dbc.CardBody([
        dbc.Row([dbc.Col(ellipro_score, style={'padding': 5})]),
        dbc.Row([
            dbc.Col(style_dropdown, style={'padding': 5}),
            dbc.Col(transplant_id, style={'padding': 5})
        ]),
        dbc.Row([dbc.Col(text_area, style={'padding': 5})]),
        dbc.Row([
            dbc.Col(mAb_switch, style={'padding': 5}),
        ]),
        dbc.Row([