Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -79,8 +79,13 @@ guidelines_text = 'Please read <a href="https://someurl.com">the guidelines</a>'
|
|
79 |
study_code = 'some code here'
|
80 |
|
81 |
intro_fields: List[Field] = [
|
82 |
-
Field(
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
84 |
]
|
85 |
|
86 |
fields: List[Field] = [
|
@@ -129,7 +134,7 @@ INPUT_FIELD_DEFAULT_VALUES = {'slider': 0,
|
|
129 |
'text': None,
|
130 |
'textarea': None,
|
131 |
'checkbox': False,
|
132 |
-
'radio':
|
133 |
'select_slider': 50,
|
134 |
'multiselect': None}
|
135 |
SHOW_HELP_ICON = False
|
@@ -211,7 +216,7 @@ def show_field(f: Field, index: int, data_collected):
|
|
211 |
value=value, help=f.help)
|
212 |
case 'radio':
|
213 |
st.session_state.data_inputs[f.name] = st.radio(f.title,
|
214 |
-
["yes","no","other"],
|
215 |
key=key,
|
216 |
help=f.help)
|
217 |
case 'slider':
|
@@ -283,14 +288,19 @@ if 'data' not in st.session_state:
|
|
283 |
if 'current_index' not in st.session_state:
|
284 |
st.session_state.current_index = -3
|
285 |
|
286 |
-
def
|
287 |
-
check = st.checkbox('I agree', key='consent')
|
288 |
if st.form_submit_button("Submit"):
|
289 |
-
if not
|
290 |
-
st.error(
|
291 |
else:
|
292 |
navigate(1)
|
293 |
|
|
|
|
|
|
|
|
|
|
|
|
|
294 |
def add_annotation_guidelines():
|
295 |
st.markdown(
|
296 |
"<details open><summary>Annotation Guidelines</summary>"+guidelines_text+"</details>"
|
|
|
79 |
study_code = 'some code here'
|
80 |
|
81 |
intro_fields: List[Field] = [
|
82 |
+
Field(type="container", title="**Introductory Questions:**", children=[
|
83 |
+
Field(name="intro_moderation_goals", type="text", title="As a moderator, what are your goals/objectives for the comment section? (free text)"),
|
84 |
+
Field(name="intro_experience", type="text", title="What do you feel contributes to a good experience for the users/discussion?"),
|
85 |
+
Field(name="intro_valuable_comment", type="text", title="What makes a comment or contribution valuable?"),
|
86 |
+
Field(name="intro_bad_comment", type="text", title="What makes a comment or contribution of poor quality, unconstructive or detrimental to the discussion?"),
|
87 |
+
|
88 |
+
]
|
89 |
]
|
90 |
|
91 |
fields: List[Field] = [
|
|
|
134 |
'text': None,
|
135 |
'textarea': None,
|
136 |
'checkbox': False,
|
137 |
+
'radio': "not selected",
|
138 |
'select_slider': 50,
|
139 |
'multiselect': None}
|
140 |
SHOW_HELP_ICON = False
|
|
|
216 |
value=value, help=f.help)
|
217 |
case 'radio':
|
218 |
st.session_state.data_inputs[f.name] = st.radio(f.title,
|
219 |
+
["yes","no","other","not selected"],
|
220 |
key=key,
|
221 |
help=f.help)
|
222 |
case 'slider':
|
|
|
288 |
if 'current_index' not in st.session_state:
|
289 |
st.session_state.current_index = -3
|
290 |
|
291 |
+
def add_validated_submit(fields, message):
|
|
|
292 |
if st.form_submit_button("Submit"):
|
293 |
+
if all(not x for x in fields):
|
294 |
+
st.error(message)
|
295 |
else:
|
296 |
navigate(1)
|
297 |
|
298 |
+
|
299 |
+
def add_checked_submit():
|
300 |
+
check = st.checkbox('I agree', key='consent')
|
301 |
+
add_validated_submit([check], "Please agree to give your consent to proceed")
|
302 |
+
|
303 |
+
|
304 |
def add_annotation_guidelines():
|
305 |
st.markdown(
|
306 |
"<details open><summary>Annotation Guidelines</summary>"+guidelines_text+"</details>"
|