Spaces:
Sleeping
Sleeping
Update index.py
Browse files
index.py
CHANGED
@@ -3,17 +3,32 @@ from app import app
|
|
3 |
|
4 |
server = app.server
|
5 |
|
6 |
-
def serve_content():
|
7 |
-
"""
|
8 |
-
:return: html div component
|
9 |
-
"""
|
10 |
-
return html.Div([
|
11 |
-
|
12 |
-
|
13 |
-
])
|
14 |
|
15 |
|
16 |
-
app.layout = serve_content()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
if __name__ == '__main__':
|
19 |
app.run_server(debug=True)
|
|
|
3 |
|
4 |
server = app.server
|
5 |
|
6 |
+
# def serve_content():
|
7 |
+
# """
|
8 |
+
# :return: html div component
|
9 |
+
# """
|
10 |
+
# return html.Div([
|
11 |
+
# dcc.Location(id='url', refresh=False),
|
12 |
+
# html.Div(id='page-content')
|
13 |
+
# ])
|
14 |
|
15 |
|
16 |
+
# app.layout = serve_content()
|
17 |
+
|
18 |
+
app.layout = html.Div([
|
19 |
+
html.H1(children='Title of Dash App', style={'textAlign':'center'}),
|
20 |
+
dcc.Dropdown(df.country.unique(), 'Canada', id='dropdown-selection'),
|
21 |
+
dcc.Graph(id='graph-content')
|
22 |
+
])
|
23 |
+
|
24 |
+
@callback(
|
25 |
+
Output('graph-content', 'figure'),
|
26 |
+
Input('dropdown-selection', 'value')
|
27 |
+
)
|
28 |
+
def update_graph(value):
|
29 |
+
dff = df[df.country==value]
|
30 |
+
return px.line(dff, x='year', y='pop')
|
31 |
+
|
32 |
|
33 |
if __name__ == '__main__':
|
34 |
app.run_server(debug=True)
|