Esempio n. 1
0
         {
             'label': 'Rulers\' Corruption',
             'value': 'adapt_rul'
         },  # FIXME: 3 states
         {
             'label': 'Reformation',
             'value': 'reform'
         },
     ],
     vals=['forg', 'adapt_rul', 'reform']),
 drc.NamedSlider(
     name="Initial Allocation Unfairness",
     id='slider-u',
     marks={i / 10: i / 10
            for i in range(10)},
     min=0,
     max=1,
     value=UInit,
     step=0.01,
     updatemode='drag',
     vertical=False),
 drc.NamedSlider(
     name="Initial Non-Compliance",
     id='slider-pcheat',
     marks={i / 10: i / 10
            for i in range(10)},
     min=0.01,
     max=1,
     value=PCheatInit,
     step=0.01,
     updatemode='drag'),
Esempio n. 2
0
 def genMainNav(self):
     dataDict = self.currentBlogInfo.copy()
     dataDict['data-buttons'] = (0,0,0)
     for k in ['data-updateIndex', 'data-updateTag', 'data-updateType', 'data-updateBlog', 'data-updateButtonIndex']:
         dataDict[k] = 0
     nav = html.Div([
         html.Div(id='state_container',
                     style={'display': 'none'},
                     **dataDict,
                 ),
         html.Div([
             drc.NamedDropdown(
                 name = 'Blog',
                 id = 'blog_selector',
                 options=[{'value' : n, 'label' : n} for n in self.names],
                 value=self['data-blogName'],
             ),
             #drc.NamedDropdown(
             #    name = 'Tag Filter',
             #    id = 'tag_filter',
             #    options=self.genCurrentTagOptions(withNum = False),
             #    value='None',
             #    multi = True,
             #),
             drc.NamedDropdown(
                 name = 'Tags',
                 id = 'tags_selector',
                 options=self.genTypeTags(withNum = True),
                 value='None',
             ),
             drc.NamedSlider(
                 name = 'Post',
                 id = 'post_selector',
                 min = 0,
                 max = self['data-maxIndex'],
                 step = 1,
                 value = 0,
                 marks = self.genPostSelectorMarks(),
                 updatemode = 'mouseup',
             ),
             drc.NamedRadioItems(
                 name = 'Type',
                 id = 'type_selector',
                 options = self.genTypesDict(),
                 value = self['data-postType'],
             ),
             html.Button(id='previous_button', n_clicks=0, children='Previous'),
             html.Button(id='next_button', n_clicks=0, children='Next'),
             drc.NamedDropdown(
                 name = 'Current Tags',
                 id = 'current_tags',
                 options=self.genCurrentTagOptions(withNum = False),
                 value=self['data-postTag'],
                 multi = True,
             ),
         ], className = 'sidenav'),
         html.Div([
             self.currentHTML(),
         ], id = 'tumblr_entry')
     ])
     return nav
Esempio n. 3
0
def serve_layout():
    # Generates a session ID
    session_id = str(uuid.uuid4())

    # Post the image to the right key, inside the bucket named after the
    # session ID
    store_image_string(utils.IMAGE_STRING_PLACEHOLDER, session_id)

    # App Layout
    return html.Div(
        id="root",
        children=[
            # Session ID
            html.Div(session_id, id="session-id"),
            
            # Main body
            html.Div(
                id="app-container",
                children=[
                    # Banner display
                    html.Div(
                        id="banner",
                        children=[ html.Img( id="logo", src=app.get_asset_url("logo_infinity.png")),
                                    html.H2("Infinity.AI", id="title"),],),
                    html.Div(
                        id="image",
                        children=[
                            # The Interactive Image Div contains the dcc Graph
                            # showing the image, as well as the hidden div storing
                            # the true image
                            html.Div( id="div-interactive-image", children= [ utils.GRAPH_PLACEHOLDER, 
                                                                            html.Div(id="div-storage",children=utils.STORAGE_PLACEHOLDER,),],)
                                ],),
                        ],),
            
            # Sidebar
            html.Div(
                id="sidebar",
                children=[
                    drc.Card([
                            dcc.Upload(
                                id="upload-image",
                                children=[ "Drag and Drop or ", html.A(children="Select a File"),],
                                # No CSS alternative here
                                style={
                                    "color": "darkgray",
                                    "width": "100%",
                                    "height": "50px",
                                    "lineHeight": "50px",
                                    "borderWidth": "1px",
                                    "borderStyle": "dashed",
                                    "borderRadius": "5px",
                                    "borderColor": "darkgray",
                                    "textAlign": "center",
                                    "padding": "2rem 0",
                                    "margin-bottom": "2rem",
                                },
                                accept="*",),
                            
                            drc.CustomDropdown(
                                id="dropdown-filters",
                                options=[
                                    {"label": "Time-Series Forecasting", "value": "time-series"},
                                    {"label": "Classification", "value": "classification"},
                                    {"label": "Regression", "value": "regression"},
                                    {"label": "Topic-Modeling", "value": "topic-modeling"},
                                ],
                                searchable=False,
                                placeholder="Select Problem",),

                            drc.CustomDropdown(
                                id="dropdown-models",
                                options=[
                                    {"label": "ARIMA", "value": "ARIMA"},
                                    {"label": "HoltsWinter", "value": "HoltsWinter"},
                                    {"label": "FbProphet", "value": "FbProphet"},
                                    {"label": "Random Forest", "value": "randomForest"},
                                    {"label": "Neural Network", "value": "neural_network"},
                                    {"label": "LSTM", "value": "LSTM"},
                                    {"label": "XGBoost", "value": "xgBoost"},
                                    {"label": "SVM", "value": "svm"},
                                    {"label": "Linear Regression", "value": "lin_reg"},
                                    {"label": "Ridge Regression", "value": "ridge_reg"},
                                    {"label": "Lasso Regression", "value": "lasso_reg"},
                                    {"label": "ElasticNet Regression", "value": "elasticnet_reg"},
                                    {"label": "GARCH", "value": "garch"},
                                    {"label": "TBATS", "value": "tbats"},
                                    {"label": "Croston", "value": "croston"},
                                ],
                                searchable=False,
                                multi=True,
                                placeholder="Select Models",),

                            drc.CustomDropdown(
                                id="dropdown-terms",
                                options=[
                                    {"label": "4 Weeks", "value": 4},
                                    {"label": "8 Weeks", "value": 8},
                                    {"label": "12 Weeks", "value": 12},
                                    {"label": "26 Week", "value": 26},
                                    {"label": "52 Weeks", "value": 52},
                                ],
                                searchable=False,
                                multi=True,
                                placeholder="Select Forecast Term",),

                            drc.CustomDropdown(
                                id="dropdown-ensemble",
                                options=[
                                    {"label": "Yes", "value": True},
                                    {"label": "No", "value": False},
                                ],
                                searchable=False,
                                placeholder="Select Ensemble",),

                            drc.CustomDropdown(
                                id="dropdown-cross_validation",
                                options=[
                                    {"label": "K-Fold", "value": "KFold"},
                                    {"label": "Leave One Out", "value": 'LeaveOneOut'},
                                    {"label": "train-val-holdout", "value": 'train_val_holdout'},
                                    {"label": "Leave P Out", "value": 'LeavePOut'},
                                ],
                                searchable=False,
                                placeholder="Select Cross-Validation",),

                            drc.CustomDropdown(
                                id="dropdown-fold_split",
                                options=[
                                    {"label": "3", "value": 3},
                                    {"label": "5", "value": 5},
                                    {"label": "7", "value": 7},
                                    {"label": "10", "value": 10},
                                    {"label": "12", "value": 12},
                                    {"label": "15", "value": 15},
                                ],
                                searchable=False,
                                multi=True,
                                placeholder="Select Fold Split",),
                            
                            html.Div(
                                id="div-enhancement-factor",
                                children=[ f"Enhancement Factor:",
                                    html.Div(
                                        children=dcc.Slider(
                                            id="slider-enhancement-factor",
                                            min=0,
                                            max=2,
                                            step=0.1,
                                            value=1,
                                            updatemode="drag",)),],),

                            drc.NamedSlider(
                                name="Train Ratio",
                                id="train_ratio",
                                min=0.5,
                                max=1.0,
                                step=0.1,
                                value=0.6,),

                            drc.NamedSlider(
                                name="Test Ratio",
                                id="test_ratio",
                                min=0.0,
                                max=0.25,
                                step=0.05,
                                value=0.1,),

                            html.Div(
                                id="button-group",
                                children=[
                                    html.Button( "Run Operation", id="button-run-operation"),],),
                            
                            # drc.NamedInlineRadioItems(
                            #     name="Select Problem",
                            #     short="selection-mode",
                            #     options=[
                            #         {"label": " Time-Series", "value": "select"},
                            #         {"label": " Classification", "value": "classification"},
                            #         {"label": " Regression", "value": "regression"},
                            #     ],
                            #     val="select",
                            # ),

                            # drc.NamedInlineRadioItems(
                            #     name="Image Display Format",
                            #     short="encoding-format",
                            #     options=[
                            #         {"label": " JPEG", "value": "jpeg"},
                            #         {"label": " PNG", "value": "png"},
                            #     ],
                            #     val="jpeg",
                            # ),
                        ]),
                    
                    # drc.Card([

                    #         # drc.NamedInlineInput(
                    #         #     name="n_steps_ahead",
                    #         #     short="n_steps_ahead",
                    #         #     placeholder="13",
                    #         #     type_input='text',
                    #         #     val="13",),

                            
                    #         ]),

                    # drc.Card([
                    #         drc.CustomDropdown(
                    #             id="dropdown-filters",
                    #             options=[
                    #                 {"label": "Time-Series Forecasting", "value": "time-series"},
                    #                 {"label": "Classification", "value": "classification"},
                    #                 {"label": "Regression", "value": "regression"},
                    #                 {"label": "Topic-Modeling", "value": "topic-modeling"},],
                    #             searchable=False,
                    #             placeholder="Select Problem...",),
                            
                    #         # drc.CustomDropdown(
                    #         #     id="dropdown-enhance",
                    #         #     options=[
                    #         #         {"label": "Brightness", "value": "brightness"},
                    #         #         {"label": "Color Balance", "value": "color"},
                    #         #         {"label": "Contrast", "value": "contrast"},
                    #         #         {"label": "Sharpness", "value": "sharpness"},
                    #         #     ],
                    #         #     searchable=False,
                    #         #     placeholder="Enhance...",
                    #         # ),
                            
                    #         html.Div(
                    #             id="div-enhancement-factor",
                    #             children=[ f"Enhancement Factor:",
                    #                 html.Div(
                    #                     children=dcc.Slider(
                    #                         id="slider-enhancement-factor",
                    #                         min=0,
                    #                         max=2,
                    #                         step=0.1,
                    #                         value=1,
                    #                         updatemode="drag",)),],),

                    #         html.Div(
                    #             id="button-group",
                    #             children=[
                    #                 html.Button( "Run Operation", id="button-run-operation"),],),
                    #     ]
                    # ),

                    dcc.Graph(
                        id="graph-histogram-colors",
                        figure={
                            "layout": {
                                "paper_bgcolor": "#272a31",
                                "plot_bgcolor": "#272a31",}},
                        config={"displayModeBar": False},),
                ],
            ),
        ],
    )
Esempio n. 4
0
                     },
                 ],
                 value='training',
                 clearable=False,
                 searchable=False)),
     ]),
 html.Div(
     className='row',
     children=[
         html.Div(
             className='four columns',
             children=drc.NamedSlider(
                 name='Polynomial Degree',
                 id='slider-polynomial-degree',
                 min=1,
                 max=10,
                 step=1,
                 value=1,
                 marks={i: str(i)
                        for i in range(1, 11)},
             )),
         html.Div(
             className='four columns',
             children=drc.NamedSlider(
                 name='Alpha (Regularization Term)',
                 id='slider-alpha',
                 min=-4,
                 max=3,
                 value=0,
                 marks={
                     i: '{}'.format(10**i)
                     for i in range(-4, 4)
Esempio n. 5
0
 drc.NamedCard(
     title="Background",
     size=4,
     children=[
         drc.NamedInput(
             name="Node Color",
             id="input-node-color",
             type="text",
             placeholder="Enter Color in Hex...",
         ),
         drc.NamedSlider(
             name="Node Opacity",
             id="slider-node-opacity",
             min=0,
             max=1,
             marks={
                 0: "0",
                 1: "1"
             },
             step=0.05,
             value=1,
         ),
         drc.NamedSlider(
             name="Node Blacken",
             id="slider-node-blacken",
             min=0,
             max=1,
             marks={
                 0: "0",
                 1: "1"
             },
             step=0.05,
Esempio n. 6
0
         'value': n,
         'label': n
     } for n in Backend.names],
     value=Backend['data-blogName'],
 ),
 drc.NamedDropdown(
     name='Tags',
     id='tags_selector',
     options=Backend.genCurrentTagOptions(withNum=True),
     value='None',
 ),
 drc.NamedSlider(
     name='Post',
     id='post_selector',
     min=0,
     max=Backend['data-maxIndex'],
     step=1,
     value=0,
     marks=Backend.genPostSelectorMarks(),
     updatemode='mouseup',
 ),
 drc.NamedRadioItems(
     name='Type',
     id='type_selector',
     options=Backend.genTypesDict(),
     value=Backend['data-postType'],
 ),
 html.Button(id='previous_button', n_clicks=0, children='Previous'),
 html.Button(id='next_button', n_clicks=0, children='Next'),
 drc.NamedDropdown(
     name='Current Tags',
     id='current_tags',