Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1219,6 +1219,61 @@ def slider_input(chat_history, user_state, attribution_slider, *args, **kwargs):
|
|
| 1219 |
gr.update(visible=False), # Slider
|
| 1220 |
gr.update(visible=False) # Confirm button
|
| 1221 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1222 |
|
| 1223 |
|
| 1224 |
# elif user_state["stage"] == "Attention Check 1":
|
|
@@ -1311,51 +1366,6 @@ def slider_input(chat_history, user_state, attribution_slider, *args, **kwargs):
|
|
| 1311 |
)
|
| 1312 |
|
| 1313 |
else:
|
| 1314 |
-
# Save data
|
| 1315 |
-
user_state["stage"] = "topic_choice"
|
| 1316 |
-
# save_to_pickle(user_state["standardized_data"])
|
| 1317 |
-
save_partial_data_to_excel({
|
| 1318 |
-
'Prolific ID': user_state["prolific_id"],
|
| 1319 |
-
'Age': user_state["standardized_data"].get("Age", None),
|
| 1320 |
-
'Profession': user_state["standardized_data"].get("Profession", None),
|
| 1321 |
-
'Interests': user_state["standardized_data"].get("Interests", None),
|
| 1322 |
-
'New Interest': user_state["standardized_data"].get("New Interest", None),
|
| 1323 |
-
'Topic Choice': user_state["standardized_data"].get("Topic Choice", None),
|
| 1324 |
-
'Vignette Number': user_state["standardized_data"].get("Vignette Number", None),
|
| 1325 |
-
'Vignette': user_state["standardized_data"].get("Vignette", None),
|
| 1326 |
-
'Tone': user_state["standardized_data"].get("Tone", None),
|
| 1327 |
-
'First Reveal': user_state["standardized_data"].get("First Reveal", None),
|
| 1328 |
-
'Raw Internal_External': user_state["standardized_data"].get("Raw Internal_External", None),
|
| 1329 |
-
'Initial Internal': user_state["standardized_data"].get("Initial Internal", None),
|
| 1330 |
-
'Initial External': user_state["standardized_data"].get("Initial External", None),
|
| 1331 |
-
'Raw Stable_Unstable': user_state["standardized_data"].get("Raw Stable_Unstable", None),
|
| 1332 |
-
'Initial Stable': user_state["standardized_data"].get("Initial Stable", None),
|
| 1333 |
-
'Initial Unstable': user_state["standardized_data"].get("Initial Unstable", None),
|
| 1334 |
-
'Raw Global_Specific': user_state["standardized_data"].get("Raw Global_Specific", None),
|
| 1335 |
-
'Initial Global': user_state["standardized_data"].get("Initial Global", None),
|
| 1336 |
-
'Initial Specific': user_state["standardized_data"].get("Initial Specific", None),
|
| 1337 |
-
'Raw Reassessment': user_state["standardized_data"].get("Raw Reassessment", None),
|
| 1338 |
-
'Reassessment Internal': user_state["standardized_data"].get("Reassessment Internal", None),
|
| 1339 |
-
'Reassessment External': user_state["standardized_data"].get("Reassessment External", None),
|
| 1340 |
-
'Initial Relevance Rating': user_state["standardized_data"].get("Initial Relevance Rating", None),
|
| 1341 |
-
'Final Relevance Rating': user_state["standardized_data"].get("Final Relevance Rating", None),
|
| 1342 |
-
'Emotional Relevance': user_state["standardized_data"].get("Emotional Relevance", None),
|
| 1343 |
-
'Positive Valence': user_state["standardized_data"].get("Positive Valence", None),
|
| 1344 |
-
'Negative Valence': user_state["standardized_data"].get("Negative Valence", None),
|
| 1345 |
-
'Likelihood of Change': user_state["standardized_data"].get("Likelihood of Change", None),
|
| 1346 |
-
"Ease of Use": user_state["standardized_data"].get("Ease of Use", None),
|
| 1347 |
-
"Clarity of Instructions": user_state["standardized_data"].get("Clarity of Instructions", None),
|
| 1348 |
-
"Engagement Level": user_state["standardized_data"].get("Engagement Level", None),
|
| 1349 |
-
"Satisfaction with Assessment": user_state["standardized_data"].get("Satisfaction with Assessment", None),
|
| 1350 |
-
"Cognitive Load": user_state["standardized_data"].get("Cognitive Load", None),
|
| 1351 |
-
"Additional Comments": user_state["standardized_data"].get("Additional Comments", None),
|
| 1352 |
-
'PHQ-9 Score': user_state["phq_score"],
|
| 1353 |
-
'GAD-7 Score': user_state["gad_score"],
|
| 1354 |
-
"Attention Check 1": user_state.get("Attention Check 1", None),
|
| 1355 |
-
"Attention Check 2": user_state.get("Attention Check 2", None)
|
| 1356 |
-
}, user_state)
|
| 1357 |
-
response = f"Thank you! We are now finished with scene {user_state['vignette_counter'] - 1}. In total you will be seeing 12 scenes.\n\nWhat would you like for your next round?\n1. A situation related to your profession.\n2. A situation related to your personal interests.\n3. Something else about me. (Add another activity or interest that is important to you by saying 'I also like...')"
|
| 1358 |
-
chat_history[-1] = (str(attribution_slider), response)
|
| 1359 |
return (
|
| 1360 |
chat_history,
|
| 1361 |
user_state,
|
|
|
|
| 1219 |
gr.update(visible=False), # Slider
|
| 1220 |
gr.update(visible=False) # Confirm button
|
| 1221 |
)
|
| 1222 |
+
|
| 1223 |
+
|
| 1224 |
+
else:
|
| 1225 |
+
# Save data
|
| 1226 |
+
user_state["stage"] = "topic_choice"
|
| 1227 |
+
# save_to_pickle(user_state["standardized_data"])
|
| 1228 |
+
save_partial_data_to_excel({
|
| 1229 |
+
'Prolific ID': user_state["prolific_id"],
|
| 1230 |
+
'Age': user_state["standardized_data"].get("Age", None),
|
| 1231 |
+
'Profession': user_state["standardized_data"].get("Profession", None),
|
| 1232 |
+
'Interests': user_state["standardized_data"].get("Interests", None),
|
| 1233 |
+
'New Interest': user_state["standardized_data"].get("New Interest", None),
|
| 1234 |
+
'Topic Choice': user_state["standardized_data"].get("Topic Choice", None),
|
| 1235 |
+
'Vignette Number': user_state["standardized_data"].get("Vignette Number", None),
|
| 1236 |
+
'Vignette': user_state["standardized_data"].get("Vignette", None),
|
| 1237 |
+
'Tone': user_state["standardized_data"].get("Tone", None),
|
| 1238 |
+
'First Reveal': user_state["standardized_data"].get("First Reveal", None),
|
| 1239 |
+
'Raw Internal_External': user_state["standardized_data"].get("Raw Internal_External", None),
|
| 1240 |
+
'Initial Internal': user_state["standardized_data"].get("Initial Internal", None),
|
| 1241 |
+
'Initial External': user_state["standardized_data"].get("Initial External", None),
|
| 1242 |
+
'Raw Stable_Unstable': user_state["standardized_data"].get("Raw Stable_Unstable", None),
|
| 1243 |
+
'Initial Stable': user_state["standardized_data"].get("Initial Stable", None),
|
| 1244 |
+
'Initial Unstable': user_state["standardized_data"].get("Initial Unstable", None),
|
| 1245 |
+
'Raw Global_Specific': user_state["standardized_data"].get("Raw Global_Specific", None),
|
| 1246 |
+
'Initial Global': user_state["standardized_data"].get("Initial Global", None),
|
| 1247 |
+
'Initial Specific': user_state["standardized_data"].get("Initial Specific", None),
|
| 1248 |
+
'Raw Reassessment': user_state["standardized_data"].get("Raw Reassessment", None),
|
| 1249 |
+
'Reassessment Internal': user_state["standardized_data"].get("Reassessment Internal", None),
|
| 1250 |
+
'Reassessment External': user_state["standardized_data"].get("Reassessment External", None),
|
| 1251 |
+
'Initial Relevance Rating': user_state["standardized_data"].get("Initial Relevance Rating", None),
|
| 1252 |
+
'Final Relevance Rating': user_state["standardized_data"].get("Final Relevance Rating", None),
|
| 1253 |
+
'Emotional Relevance': user_state["standardized_data"].get("Emotional Relevance", None),
|
| 1254 |
+
'Positive Valence': user_state["standardized_data"].get("Positive Valence", None),
|
| 1255 |
+
'Negative Valence': user_state["standardized_data"].get("Negative Valence", None),
|
| 1256 |
+
'Likelihood of Change': user_state["standardized_data"].get("Likelihood of Change", None),
|
| 1257 |
+
"Ease of Use": user_state["standardized_data"].get("Ease of Use", None),
|
| 1258 |
+
"Clarity of Instructions": user_state["standardized_data"].get("Clarity of Instructions", None),
|
| 1259 |
+
"Engagement Level": user_state["standardized_data"].get("Engagement Level", None),
|
| 1260 |
+
"Satisfaction with Assessment": user_state["standardized_data"].get("Satisfaction with Assessment", None),
|
| 1261 |
+
"Cognitive Load": user_state["standardized_data"].get("Cognitive Load", None),
|
| 1262 |
+
"Additional Comments": user_state["standardized_data"].get("Additional Comments", None),
|
| 1263 |
+
'PHQ-9 Score': user_state["phq_score"],
|
| 1264 |
+
'GAD-7 Score': user_state["gad_score"],
|
| 1265 |
+
"Attention Check 1": user_state.get("Attention Check 1", None),
|
| 1266 |
+
"Attention Check 2": user_state.get("Attention Check 2", None)
|
| 1267 |
+
}, user_state)
|
| 1268 |
+
response = f"Thank you! We are now finished with scene {user_state['vignette_counter'] - 1}. In total you will be seeing 12 scenes.\n\nWhat would you like for your next round?\n1. A situation related to your profession.\n2. A situation related to your personal interests.\n3. Something else about me. (Add another activity or interest that is important to you by saying 'I also like...')"
|
| 1269 |
+
chat_history[-1] = (str(attribution_slider), response)
|
| 1270 |
+
return (
|
| 1271 |
+
chat_history,
|
| 1272 |
+
user_state,
|
| 1273 |
+
gr.update(visible=True, value=""), # Textbox
|
| 1274 |
+
gr.update(visible=False), # Slider
|
| 1275 |
+
gr.update(visible=False) # Confirm button
|
| 1276 |
+
)
|
| 1277 |
|
| 1278 |
|
| 1279 |
# elif user_state["stage"] == "Attention Check 1":
|
|
|
|
| 1366 |
)
|
| 1367 |
|
| 1368 |
else:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1369 |
return (
|
| 1370 |
chat_history,
|
| 1371 |
user_state,
|