forked from SeanPLeary/dash-image-annotator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
35 lines (26 loc) · 1.09 KB
/
index.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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from app import app
from apps import annotator, uploader, config
app.layout = html.Div([
dcc.Location(id='url-location', refresh=False, href='/apps/annotator'),
dcc.Link(id='link', children='Navigate to uploader', href='/apps/uploader'),
html.Br(),
# content will be rendered in this element
html.Div(id='page-content')
])
@app.callback([Output('page-content', 'children'),
Output('link', 'children'),
Output('link', 'href')],
[Input('url-location', 'pathname')])
def display_page(pathname):
if pathname == '/apps/annotator':
return annotator.layout, 'Navigate to uploader', '/apps/uploader'
if pathname == '/apps/uploader':
return uploader.layout, 'Navigate to annotator', '/apps/annotator'
return annotator.layout, 'Navigate to uploader', '/apps/uploader'
if __name__ == '__main__':
app.run_server(host=config.HOST, port=config.PORT, debug=True)