-
Notifications
You must be signed in to change notification settings - Fork 1
/
carrotcallbacks.py
90 lines (69 loc) · 2.29 KB
/
carrotcallbacks.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
from dash.dependencies import Input, Output, State
from app import app
from carrotlayout import *
import carrotmysql
@app.callback(Output('tabs-content', 'children'),
[Input('tabs', 'value')])
def render_content(tab):
if tab == 'loss':
return loss_display()
elif tab == 'accuracy':
return accuracy_display()
elif tab == 'model':
return model_display()
elif tab == 'parameters':
return parameters_display()
elif tab == 'gradients':
return gradients_display()
# Setting to 0 initial value of the slider
@app.callback(Output('parameters-slider', 'value'),
[Input('parameters-dropdown', 'value')])
def update_output(input1):
return 0
@app.callback(Output('parameters-graph', 'figure'),
[Input('parameters-slider', 'value')],
[State('parameters-dropdown', 'value')])
def update_output(input1, input2):
arr = carrotmysql.query.batch_seq(input1)
return {
'data': [
{'x': arr[0],
'y': arr[1],
'z': arr[2],
'type': 'scatter3d', 'name': input2}
],
'layout': {
'title': input2
}
}
@app.callback(Output('parameters-slider', 'max'),
[Input('parameters-dropdown', 'value')])
def update_output(input1):
carrotmysql.query.search_layer(input1, parameter=True)
return carrotmysql.query.batch_size
# Setting to 0 initial value of the slider
@app.callback(Output('gradients-slider', 'value'),
[Input('gradients-dropdown', 'value')])
def update_output(input1):
return 0
@app.callback(Output('gradients-graph', 'figure'),
[Input('gradients-slider', 'value')],
[State('gradients-dropdown', 'value')])
def update_output(input1, input2):
arr = carrotmysql.query.batch_seq(input1)
return {
'data': [
{'x': arr[0],
'y': arr[1],
'z': arr[2],
'type': 'scatter3d', 'name': input2}
],
'layout': {
'title': input2
}
}
@app.callback(Output('gradients-slider', 'max'),
[Input('gradients-dropdown', 'value')])
def update_output(input1):
carrotmysql.query.search_layer(input1, parameter=False)
return carrotmysql.query.batch_size