Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -32,6 +32,11 @@ output_repo_path = 'datasets/emvecchi/annotate-pilot'
|
|
32 |
to_annotate_file_name = 'to_annotate.csv' # CSV file to annotate
|
33 |
COLS_TO_SAVE = ['comment_id']
|
34 |
|
|
|
|
|
|
|
|
|
|
|
35 |
fields: List[Field] = [
|
36 |
Field(name="topic", type="input_col", title="**Topic:**"),
|
37 |
Field(name="parent_comment", type="input_col", title="**Preceeding Comment:**"),
|
@@ -41,7 +46,7 @@ fields: List[Field] = [
|
|
41 |
Field(type="container", title="", children=[
|
42 |
Field(name="to_moderate", type="radio",
|
43 |
title="**Moderator Intervention**: Do feel this comment/discussion would benefit from moderator intervention?"),
|
44 |
-
Field(name="actions_clear", type="
|
45 |
title="**Priority**: With what level of priority would you need to interact with this comment?"),
|
46 |
]),
|
47 |
#Field(type="expander",
|
@@ -72,11 +77,12 @@ fields: List[Field] = [
|
|
72 |
#
|
73 |
Field(name="other_comments", type="text", title="Further comments: free text"),
|
74 |
]
|
75 |
-
INPUT_FIELD_DEFAULT_VALUES = {'slider':
|
76 |
'text': None,
|
77 |
'textarea': None,
|
78 |
'checkbox': False,
|
79 |
-
'radio': None
|
|
|
80 |
SHOW_HELP_ICON = False
|
81 |
|
82 |
def read_data(_path):
|
@@ -165,6 +171,13 @@ def show_field(f: Field, index: int):
|
|
165 |
min_value=1, max_value=7, step=1,
|
166 |
key=key,
|
167 |
value=value, help=f.help)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
case 'text':
|
169 |
st.session_state.data_inputs[f.name] = st.text_input(f.title, key=key, value=value)
|
170 |
case 'textarea':
|
|
|
32 |
to_annotate_file_name = 'to_annotate.csv' # CSV file to annotate
|
33 |
COLS_TO_SAVE = ['comment_id']
|
34 |
|
35 |
+
agreement_labels = ['strongly disagree', 'disagree', 'neither agree no disagree', 'agree', 'strongly agree']
|
36 |
+
quality_labels = ['very poor', 'poor', 'acceptable', 'good', 'very good']
|
37 |
+
priority_labels = ['not a priority', 'low priority', 'somewhat a priority', 'neutral', 'moderate priority', 'high priority', 'essential priority']
|
38 |
+
default_labels = agreement_labels
|
39 |
+
|
40 |
fields: List[Field] = [
|
41 |
Field(name="topic", type="input_col", title="**Topic:**"),
|
42 |
Field(name="parent_comment", type="input_col", title="**Preceeding Comment:**"),
|
|
|
46 |
Field(type="container", title="", children=[
|
47 |
Field(name="to_moderate", type="radio",
|
48 |
title="**Moderator Intervention**: Do feel this comment/discussion would benefit from moderator intervention?"),
|
49 |
+
Field(name="actions_clear", type="select_slider",
|
50 |
title="**Priority**: With what level of priority would you need to interact with this comment?"),
|
51 |
]),
|
52 |
#Field(type="expander",
|
|
|
77 |
#
|
78 |
Field(name="other_comments", type="text", title="Further comments: free text"),
|
79 |
]
|
80 |
+
INPUT_FIELD_DEFAULT_VALUES = {'slider': 0,
|
81 |
'text': None,
|
82 |
'textarea': None,
|
83 |
'checkbox': False,
|
84 |
+
'radio': None,
|
85 |
+
'select_slider': 0}
|
86 |
SHOW_HELP_ICON = False
|
87 |
|
88 |
def read_data(_path):
|
|
|
171 |
min_value=1, max_value=7, step=1,
|
172 |
key=key,
|
173 |
value=value, help=f.help)
|
174 |
+
case 'select_slider':
|
175 |
+
labels = default_labels if not f.other_params.get('labels') else f.other_params.get('labels')
|
176 |
+
st.session_state.data_inputs[f.name] = st.select_slider(f.title,
|
177 |
+
options=labels,
|
178 |
+
#format_func=lambda x: labels[x // 25],
|
179 |
+
key=key,
|
180 |
+
value=labels[3], help=f.help)
|
181 |
case 'text':
|
182 |
st.session_state.data_inputs[f.name] = st.text_input(f.title, key=key, value=value)
|
183 |
case 'textarea':
|