Skip to content

Commit 63359df

Browse files
Moritz WolfMoritz Wolf
Moritz Wolf
authored and
Moritz Wolf
committed
Merge branch 'master' of https://github.com/uds-lsv/human
2 parents a4f0191 + 89efe91 commit 63359df

8 files changed

+78
-49
lines changed

Pipfile.lock

+54-35
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/main.py

-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
def create_app():
77
return Flask(__name__)
88

9-
109
app = create_app()
1110
app.config['SECRET_KEY']='secret_session'
1211
socketio = SocketIO(app)
@@ -19,6 +18,5 @@ def create_session():
1918
def disconnect_user():
2019
session.pop('secret_session', None)
2120

22-
2321
if __name__ == '__main__':
2422
app.run(debug=True)

app/routes.py

+2
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,8 @@ def get_daily_annotations(df: pd.DataFrame):
767767
'''
768768
get amount of annotations per day
769769
'''
770+
if df.empty:
771+
return []
770772
df = df.set_index('timestamp')
771773
days = [group[1].shape[0] for group in df.groupby([df.index.year,df.index.month,df.index.day])]
772774
return days

app/static/automaton.ts

+15-8
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export class Automaton {
2424

2525
currentannotation
2626
machine: any
27-
timestamp = new Date().getTime()
2827

2928
constructor() {}
3029

@@ -33,9 +32,12 @@ export class Automaton {
3332
* @param data (optional) data object which is sent to next state as an event
3433
*/
3534
next(target: string, data?: any) {
36-
console.log(target)
37-
let choice = { type: target, data }
38-
this.CURRENTSTATE.send(choice)
35+
return new Promise((resolve, reject) => {
36+
console.log(target)
37+
let choice = { type: target, data }
38+
this.CURRENTSTATE.send(choice)
39+
resolve(null)
40+
})
3941
}
4042

4143
initAutomaton(annotationProtocol, start?) {
@@ -160,10 +162,15 @@ export class Automaton {
160162
},
161163
showUI: (_, event, actionMeta) => {
162164
const timestamp2 = new Date().getTime()
163-
Data.annotations['timings'].push(
164-
(actionMeta.state.value, timestamp2 - this.timestamp)
165-
)
166-
this.timestamp = timestamp2
165+
if (Data.timestamp) {
166+
console.log(
167+
(actionMeta.state.value, timestamp2 - Data.timestamp)
168+
)
169+
Data.annotations['timings'].push(
170+
(actionMeta.state.value, timestamp2 - Data.timestamp)
171+
)
172+
}
173+
Data.timestamp = timestamp2
167174

168175
let meta =
169176
actionMeta.state.meta[

app/static/data.ts

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export let Data = {
2828
guiBBoxes: [],
2929
scales: { x: 1, y: 1 },
3030
active: -1,
31+
timestamp: 0,
3132
reset: () => {
3233
Data.data = undefined
3334
Data.text = ''
@@ -40,6 +41,7 @@ export let Data = {
4041
Data.predicted_labels = []
4142
Data.guiBBoxes = []
4243
Data.scales = { x: 1, y: 1 }
44+
Data.timestamp = 0
4345
},
4446
}
4547
window['data'] = Data

app/templates/annotation_page.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ <h3 class="card-subtitle">Context</h3>
8181
id="fzf-toggle">fzf</button>
8282
</div>
8383
</div>
84-
<ul style="overflow: scroll; height: 100%; margin-top: 10px; -webkit-overflow-scrolling: touch;"
84+
<ul style="overflow: scroll; margin-top: 10px; -webkit-overflow-scrolling: touch;"
8585
id="word-list" class="list-group">
8686
<button id="input-item" class="list-group-item" style="text-align: left;"></button>
8787
</ul>

environment.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ dependencies:
1111
- pandas
1212
- pip
1313
- pillow
14-
- pip:
15-
- requests-toolbelt
14+
- pytables
15+
- requests-toolbelt
16+
- tqdm

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ MarkupSafe==1.1.1
1212
numpy==1.20.2
1313
olefile==0.46
1414
pandas==1.2.4
15-
Pillow==8.2.0
15+
Pillow==8.3.2
1616
python-dateutil==2.8.1
1717
pytz==2020.1
1818
requests==2.25.1

0 commit comments

Comments
 (0)