Spaces:
Runtime error
Runtime error
Ruben Wolhandler
commited on
Commit
·
569de68
1
Parent(s):
a9448d0
some update for annotators
Browse files
app.py
CHANGED
@@ -14,22 +14,36 @@ CONTEXT_SENT_1_h_1_RES = f'DUC/output_dir/sent_window_1_h_1_clusters/{generated_
|
|
14 |
source_path = 'DUC/sent_window_1_h_1_clusters/test.source'
|
15 |
|
16 |
OPTIONS = ["faithfull", "Not faithfull"]
|
|
|
|
|
17 |
|
18 |
if "number_button_fill" not in state:
|
19 |
state.number_button_fill = 0
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
if "annotations" not in state:
|
22 |
state.annotations = {}
|
23 |
state.annotations['data_id', 'index', 'output', 'model', 'is_faithfull'] = ''
|
24 |
f_0 = open(source_path)
|
25 |
-
|
|
|
26 |
f_1 = open(ORI_RES)
|
27 |
-
|
|
|
28 |
# f_2 = open(CONTEXT_SENT_0_h_0_RES)
|
29 |
f_3 = open(CONTEXT_SENT_0_h_1_RES)
|
30 |
-
|
|
|
31 |
f_4 = open(CONTEXT_SENT_1_h_1_RES)
|
32 |
-
|
|
|
33 |
state.files = list(zip(source, ori_res, sent_0_h_1, sent_1_h_1))
|
34 |
state.current_file = state.files[0]
|
35 |
state.counter = 0
|
@@ -51,9 +65,9 @@ def submit(index_0, index_1, index_2):
|
|
51 |
state.counter += 1
|
52 |
state.submit = 0
|
53 |
|
54 |
-
st.header("Dataset annotation")
|
55 |
|
56 |
if state.files:
|
|
|
57 |
selected_file = state.current_file
|
58 |
# source_file = selected_file[0]
|
59 |
# ori_file = selected_file[1]
|
|
|
14 |
source_path = 'DUC/sent_window_1_h_1_clusters/test.source'
|
15 |
|
16 |
OPTIONS = ["faithfull", "Not faithfull"]
|
17 |
+
Annotators = ['Ruben', 'Arie']
|
18 |
+
annotators_dic = {'Ruben':10, 'Arie':60}
|
19 |
|
20 |
if "number_button_fill" not in state:
|
21 |
state.number_button_fill = 0
|
22 |
|
23 |
+
def annotate(annotator):
|
24 |
+
state.annotator = annotator
|
25 |
+
|
26 |
+
if "annotator" not in state:
|
27 |
+
c = st.columns(len(Annotators))
|
28 |
+
for idx, option in enumerate(OPTIONS):
|
29 |
+
c[idx].button(f"{option}", on_click=annotate, args=(option,))
|
30 |
+
|
31 |
if "annotations" not in state:
|
32 |
state.annotations = {}
|
33 |
state.annotations['data_id', 'index', 'output', 'model', 'is_faithfull'] = ''
|
34 |
f_0 = open(source_path)
|
35 |
+
source_ = f_0.read().split('\n')
|
36 |
+
source = source_[:N] + source_[annotators_dic[state.annotators]:annotators_dic[state.annotators]+50]
|
37 |
f_1 = open(ORI_RES)
|
38 |
+
ori_res_ = f_1.read().split('\n')
|
39 |
+
ori_res = ori_res_[:N] + ori_res_[annotators_dic[state.annotators]:annotators_dic[state.annotators]+50]
|
40 |
# f_2 = open(CONTEXT_SENT_0_h_0_RES)
|
41 |
f_3 = open(CONTEXT_SENT_0_h_1_RES)
|
42 |
+
sent_0_h_1_ = f_3.read().split('\n')
|
43 |
+
sent_0_h_1 = sent_0_h_1_[:N] + sent_0_h_1_[annotators_dic[state.annotators]:annotators_dic[state.annotators]+50]
|
44 |
f_4 = open(CONTEXT_SENT_1_h_1_RES)
|
45 |
+
sent_1_h_1_ = f_4.read().split('\n')
|
46 |
+
sent_1_h_1 = sent_1_h_1_[:N] + sent_1_h_1_[annotators_dic[state.annotators]:annotators_dic[state.annotators]+50]
|
47 |
state.files = list(zip(source, ori_res, sent_0_h_1, sent_1_h_1))
|
48 |
state.current_file = state.files[0]
|
49 |
state.counter = 0
|
|
|
65 |
state.counter += 1
|
66 |
state.submit = 0
|
67 |
|
|
|
68 |
|
69 |
if state.files:
|
70 |
+
st.header("Dataset annotation")
|
71 |
selected_file = state.current_file
|
72 |
# source_file = selected_file[0]
|
73 |
# ori_file = selected_file[1]
|