-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
89 lines (79 loc) · 3.48 KB
/
run.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
# Imports from 3rd party libraries
import dash
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
# Imports from this application
from app import app, server
from pages import index, predict
# Navbar docs: https://dash-bootstrap-components.opensource.faculty.ai/l/components/navbar
navbar = dbc.NavbarSimple(
brand='Airbnb Price Predictor',
brand_href='/',
children=[
dbc.NavItem(dcc.Link('Predictions', href='/predictions', className='nav-link')),
# dbc.NavItem(dcc.Link('Insights', href='/insights', className='nav-link')),
# dbc.NavItem(dcc.Link('Process', href='/process', className='nav-link')),
],
sticky='top',
color='#FF5A60',
light=True,
dark=True
)
# Footer docs:
# dbc.Container, dbc.Row, dbc.Col: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout
# html.P: https://dash.plot.ly/dash-html-components
# fa (font awesome) : https://fontawesome.com/icons/github-square?style=brands
# mr (margin right) : https://getbootstrap.com/docs/4.3/utilities/spacing/
# className='lead' : https://getbootstrap.com/docs/4.3/content/typography/#lead
footer = dbc.Container(
dbc.Row(
dbc.Col(
html.P(
[
html.Span('FT-Airbnb-Price-01', className='mr-1'),
html.A(html.I(className='fab fa-github-square mr-1'), href='https://github.com/ft-airbnb-price-01/AirBnB-Optimal-Price'),
html.Span('Joshua Elamin', className='mr-1'),
html.A(html.I(className='fab fa-github-square mr-1'), href='https://github.com/JAaron93'),
html.A(html.I(className='fab fa-linkedin mr-1'), href='https://www.linkedin.com/in/joshua-elamin-2b2ba9209/'),
html.Span('Andrew Lee', className='mr-1'),
html.A(html.I(className='fab fa-github-square mr-1'), href='https://github.com/andrewlee977'),
html.A(html.I(className='fab fa-linkedin mr-1'), href='https://www.linkedin.com/in/andrewlee97/'),
html.Span('Ian Knight', className='mr-1'),
html.A(html.I(className='fab fa-github-square mr-1'), href='https://github.com/iknight7000'),
html.A(html.I(className='fab fa-linkedin mr-1'), href='https://www.linkedin.com/in/ianknight480/'),
],
className='lead'
)
)
)
)
# Layout docs:
# html.Div: https://dash.plot.ly/getting-started
# dcc.Location: https://dash.plot.ly/dash-core-components/location
# dbc.Container: https://dash-bootstrap-components.opensource.faculty.ai/l/components/layout
app.layout = html.Div([
dcc.Location(id='url', refresh=False),
navbar,
dbc.Container(id='page-content', className='mt-4'),
html.Hr(),
footer
])
# URL Routing for Multi-Page Apps: https://dash.plot.ly/urls
@app.callback(Output('page-content', 'children'),
[Input('url', 'pathname')])
def display_page(pathname):
if pathname == '/':
return index.layout
elif pathname == '/predictions':
return predict.layout
# elif pathname == '/insights':
# return insights.layout
# elif pathname == '/process':
# return process.layout
else:
return dcc.Markdown('## Page not found')
# Run app server: https://dash.plot.ly/getting-started
if __name__ == '__main__':
app.run_server(debug=True)