-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.py
More file actions
38 lines (31 loc) · 1.02 KB
/
dashboard.py
File metadata and controls
38 lines (31 loc) · 1.02 KB
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
import dash
from dash import dcc, html
from dash.dependencies import Input, Output
from plotting import create_figure
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app.layout = html.Div(
[
html.H4("Classification"),
"x axis",
dcc.RadioItems(
["epochs", "time"],
"epochs",
id="xaxis-type",
),
dcc.Graph(id="live-update-graph"),
dcc.Interval(id="interval-component", interval=10 * 1000, n_intervals=0),
],
)
@app.callback(
Output("live-update-graph", "figure"),
Input("interval-component", "n_intervals"),
Input("xaxis-type", "value"),
)
def update_graph_live(n_intervals: int, x_axis_radio_item: str):
x_axis_name = {"epochs": "epoch", "time": "time"}
fig = create_figure(x_axis_name[x_axis_radio_item])
fig.update_layout(uirevision=x_axis_radio_item)
return fig
if __name__ == "__main__":
app.run_server(debug=True)