-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (49 loc) · 1.71 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import dash
from dash import Dash, html, dcc, Input, Output, State, html
import dash_bootstrap_components as dbc
from dash_bootstrap_components._components.Container import Container
from flask import Flask
import os
server = Flask(__name__)
app = Dash(__name__, use_pages=True,
server=server,
pages_folder=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pages'),
external_stylesheets=[dbc.themes.BOOTSTRAP])
navbar = dbc.Navbar(
[
dbc.NavbarToggler(id="navbar-toggler"),
dbc.Collapse(
dbc.Nav(
[
dbc.DropdownMenu(
children=[dbc.DropdownMenuItem('Home', href='/')] +
[
dbc.DropdownMenuItem(page['name'], href=page['path'])
for page in dash.page_registry.values() if page['name'] != 'Landing'
],
nav=True,
in_navbar=True,
label="Other Pages",
right=False, # Move the dropdown to the right
direction="down"
),
],
className="ml-auto", # Align menu to the right
navbar=True,
),
id="navbar-collapse",
navbar=True,
),
dbc.NavbarBrand("Machine Learning Fall 2023", href="#"),
],
color="dark",
dark=True,
expand="lg", # Expand to full width for the hamburger menu
fixed="top", # Fixed position at the top
)
app.layout = html.Div([
navbar,
dash.page_container
])
if __name__ == '__main__':
app.run(debug=True)