-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapp.py
100 lines (92 loc) · 2.55 KB
/
app.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
import dash
import dash_bootstrap_components as dbc
from dash import Dash, dcc, html
app = Dash(
__name__,
use_pages=True,
title="Amazon Dashboard",
external_stylesheets=[dbc.themes.BOOTSTRAP],
)
server = app.server
# sidebar
sidebar = html.Div(
[
dbc.Row(
[html.Img(src="assets/logos/amazon.svg", style={"height": "35px"})],
className="sidebar-logo",
),
html.Hr(),
dbc.Nav(
[
dbc.NavLink(
"Purchase Overview", href="/puchase_overview", active="exact"
),
dbc.NavLink(
"Customer demographics",
href="/customer_demographics",
active="exact",
),
dbc.NavLink(
"Book recommendation", href="/book_recommendation", active="exact"
),
],
vertical=True,
pills=True,
),
html.Div(
[
html.Span("Created by "),
html.A(
"Mayara Daher",
href="https://github.com/mayaradaher",
target="_blank",
),
html.Br(),
html.Span("Data Source "),
html.A(
"MIT Publication",
href="https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/YGLYDY",
target="_blank",
),
],
className="subtitle-sidebar",
style={"position": "absolute", "bottom": "10px", "width": "100%"},
),
],
className="sidebar",
)
content = html.Div(
className="page-content",
)
# defining font-awesome (icons) and fonts
app.index_string = """
<!DOCTYPE html>
<html>
<head>
{%metas%}
{%css%}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<link rel="icon" href="/assets/logos/favicon.svg" type="image/x-icon">
</head>
<body>
{%app_entry%}
{%config%}
{%scripts%}
{%renderer%}
</body>
</html>
<style>
@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap');
</style>
"""
# layout
app.layout = html.Div(
[
dcc.Location(id="url", pathname="/puchase_overview"),
sidebar,
content,
dash.page_container,
]
)
if __name__ == "__main__":
app.run_server(debug=False)