Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
democrasci_preprocWP1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Luis Salamanca
democrasci_preprocWP1
Commits
721f499d
Commit
721f499d
authored
5 years ago
by
Laurence Brandenberger
Browse files
Options
Downloads
Patches
Plain Diff
update dashboard.
parent
8b0da0c2
No related branches found
Branches containing commit
No related tags found
2 merge requests
!30
Class textbox
,
!29
Web app labelling backend
Pipeline
#16979
failed
5 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/python/dashboard/app.py
+9
-6
9 additions, 6 deletions
src/python/dashboard/app.py
src/python/dashboard/callbacks.py
+27
-12
27 additions, 12 deletions
src/python/dashboard/callbacks.py
with
36 additions
and
18 deletions
src/python/dashboard/app.py
+
9
−
6
View file @
721f499d
...
@@ -19,7 +19,7 @@ app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
...
@@ -19,7 +19,7 @@ app = dash.Dash(__name__, external_stylesheets=external_stylesheets)
app
.
layout
=
html
.
Div
([
app
.
layout
=
html
.
Div
([
# storage
# storage
dcc
.
Store
(
id
=
'
session
'
,
storage_type
=
'
session
'
),
dcc
.
Store
(
id
=
'
session
'
,
storage_type
=
'
memory
'
),
# html.Div([
# html.Div([
# html.Button(id="start-button",n_clicks=0, children='Start')
# html.Button(id="start-button",n_clicks=0, children='Start')
# ],id="start-page"),
# ],id="start-page"),
...
@@ -37,13 +37,16 @@ app.layout = html.Div([
...
@@ -37,13 +37,16 @@ app.layout = html.Div([
html
.
Div
([
html
.
Div
([
html
.
Div
([
html
.
Div
([
html
.
H3
(
"
Validation
"
),
html
.
H3
(
"
Validation
"
),
html
.
Div
([
html
.
Pre
(
"
File ID:
"
,
className
=
"
label
"
),
html
.
Div
([
html
.
Pre
(
"
Year:
"
,
className
=
"
label
"
),
html
.
Pre
(
"
11000103
"
,
className
=
"
value
"
,
id
=
"
file-id
"
),
html
.
Pre
(
""
,
className
=
"
value
"
,
id
=
"
year
"
),
html
.
Pre
(
"
Year:
"
,
className
=
"
label
"
),
html
.
Pre
(
"
File ID:
"
,
className
=
"
label
"
),
html
.
Pre
(
"
1995
"
,
className
=
"
value
"
,
id
=
"
year
"
),],
className
=
"
meta-container
"
),
html
.
Pre
(
""
,
className
=
"
value
"
,
id
=
"
file-id
"
),
html
.
Pre
(
"
Page ID:
"
,
className
=
"
label
"
),
html
.
Pre
(
""
,
className
=
"
value
"
,
id
=
"
page-id
"
),
],
className
=
"
meta-container
"
),
html
.
Div
([
html
.
Div
([
html
.
Button
(
id
=
"
skip-button
"
,
n_clicks
=
0
,
children
=
'
Skip
'
,
style
=
{
"
marginRight
"
:
"
1rem
"
}),
html
.
Button
(
id
=
"
skip-button
"
,
n_clicks
=
0
,
children
=
'
Skip
'
,
style
=
{
"
marginRight
"
:
"
1rem
"
,
"
display
"
:
"
none
"
}),
html
.
Button
(
id
=
'
commit-button
'
,
n_clicks
=
0
,
children
=
'
Commit
'
,
style
=
{
"
backgroundColor
"
:
"
rgba(0,126,255,.08)
"
,
"
color
"
:
"
#007eff
"
})
html
.
Button
(
id
=
'
commit-button
'
,
n_clicks
=
0
,
children
=
'
Commit
'
,
style
=
{
"
backgroundColor
"
:
"
rgba(0,126,255,.08)
"
,
"
color
"
:
"
#007eff
"
})
])
])
]),
]),
...
...
This diff is collapsed.
Click to expand it.
src/python/dashboard/callbacks.py
+
27
−
12
View file @
721f499d
...
@@ -35,7 +35,6 @@ def boxes_to_list(bboxes):
...
@@ -35,7 +35,6 @@ def boxes_to_list(bboxes):
return
box_list
return
box_list
def
setup
(
app
):
def
setup
(
app
):
@app.callback
(
@app.callback
(
Output
(
"
canvas
"
,
"
categories
"
),
Output
(
"
canvas
"
,
"
categories
"
),
...
@@ -47,20 +46,38 @@ def setup(app):
...
@@ -47,20 +46,38 @@ def setup(app):
return
[
cat
]
return
[
cat
]
return
cat
return
cat
@app.callback
(
@app.callback
(
Output
(
"
session
"
,
"
data
"
),
Output
(
"
session
"
,
"
data
"
),
[
Input
(
"
skip-button
"
,
"
n_clicks
"
)]
[
Input
(
"
skip-button
"
,
"
n_clicks
"
)],
[
State
(
"
session
"
,
"
data
"
)]
)
)
def
skip
(
n_clicks
):
def
skip
(
n_clicks
,
past_data
):
if
n_clicks
is
None
:
if
n_clicks
is
None
or
n_clicks
<
1
:
r
aise
PreventUp
dat
e
r
eturn
past_
dat
a
print
(
"
Next page...
"
)
print
(
"
Next page...
"
)
image
,
labelled_bboxes
,
metaData
=
exhaustive_labelling
.
load_nextPageToLabel
()
image
,
labelled_bboxes
,
metaData
=
exhaustive_labelling
.
load_nextPageToLabel
()
return
json
.
dumps
({
"
image
"
:
image_to_byte
(
image
),
"
boxes
"
:
boxes_to_list
(
labelled_bboxes
),
"
meta
"
:
serialize_obj
(
metaData
)})
return
json
.
dumps
({
"
image
"
:
image_to_byte
(
image
),
"
boxes
"
:
boxes_to_list
(
labelled_bboxes
),
"
meta
"
:
serialize_obj
(
metaData
)})
@app.callback
(
Output
(
"
file-id
"
,
"
children
"
),
[
Input
(
"
session
"
,
"
data
"
)]
)
def
update_file_id
(
data
):
return
json
.
loads
(
data
).
get
(
"
meta
"
,{}).
get
(
"
file_id
"
,
""
)
@app.callback
(
Output
(
"
page-id
"
,
"
children
"
),
[
Input
(
"
session
"
,
"
data
"
)]
)
def
update_page_id
(
data
):
return
json
.
loads
(
data
).
get
(
"
meta
"
,{}).
get
(
"
page_id
"
,
""
)
@app.callback
(
Output
(
"
year
"
,
"
children
"
),
[
Input
(
"
session
"
,
"
data
"
)]
)
def
update_year
(
data
):
return
json
.
loads
(
data
).
get
(
"
meta
"
,{}).
get
(
"
year
"
,
""
)
@app.callback
(
@app.callback
(
Output
(
"
skip-button
"
,
"
n_clicks
"
),
Output
(
"
skip-button
"
,
"
n_clicks
"
),
...
@@ -71,19 +88,17 @@ def setup(app):
...
@@ -71,19 +88,17 @@ def setup(app):
State
(
"
skip-button
"
,
"
n_clicks
"
)]
State
(
"
skip-button
"
,
"
n_clicks
"
)]
)
)
def
commit
(
n_clicks
,
cutoff
,
session
,
data
,
n_clicks_state
):
def
commit
(
n_clicks
,
cutoff
,
session
,
data
,
n_clicks_state
):
print
(
"
Commiting...
"
)
if
(
n_clicks
<
1
or
n_clicks
is
None
):
return
n_clicks_state
+
1
meta
=
json
.
loads
(
session
)[
"
meta
"
]
meta
=
json
.
loads
(
session
)[
"
meta
"
]
m_entry
=
[]
m_entry
=
[]
for
entry
in
data
:
for
entry
in
data
:
if
entry
[
"
pred
"
]
>
cutoff
:
if
entry
[
"
pred
"
]
>
cutoff
:
entry
[
"
prob
"
]
=
1
entry
[
"
prob
"
]
=
1
else
:
else
:
entry
[
"
prob
"
]
=
0
entry
[
"
prob
"
]
=
0
del
entry
[
"
pred
"
]
del
entry
[
"
pred
"
]
m_entry
.
append
(
entry
)
m_entry
.
append
(
entry
)
print
(
"
entry
"
,
m_entry
)
if
len
(
m_entry
):
if
len
(
m_entry
):
exhaustive_labelling
.
save_labelledPage
(
m_entry
,
meta
)
exhaustive_labelling
.
save_labelledPage
(
m_entry
,
meta
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment