bjorn-hommel commited on
Commit
021a052
1 Parent(s): e011d51

minor fixes

Browse files
Files changed (2) hide show
  1. app.py +11 -6
  2. utils.py +1 -1
app.py CHANGED
@@ -82,7 +82,7 @@ def get_user_info():
82
  gender_value = gender_options.index(gender_input)
83
 
84
  expert_options = [
85
- '[PLEASE SELECT]',
86
  'No, I do not have a background in social or behavioral sciences',
87
  'Yes, I have either studied social or behavioral sciences or I am currently a student in this field',
88
  'Yes, I have either worked as a researcher in the field of social or behavioral sciences or I have had past experience as a researcher in this area'
@@ -261,7 +261,9 @@ def show_data(placeholder):
261
  st.divider()
262
  st.markdown("""
263
  ## Explore the data
264
- Figures show the accuarcy in precitions of human-rated item desirability by the sentiment model (left) and the desirability model (right), using `test`-partition data only.
 
 
265
  """)
266
 
267
  show_covariates = st.checkbox('Show covariates', value=True)
@@ -270,19 +272,22 @@ def show_data(placeholder):
270
  else:
271
  option = None
272
 
273
- if 'df' in st.session_state:
274
- plot = plots.scatter_plot(st.session_state.df, option)
275
- st.plotly_chart(plot, theme=None, use_container_width=True)
 
 
276
 
277
  def main():
278
  st.markdown("""
279
  # Machine-Based Item Desirability Ratings
280
- This web application demonstrates how item desirability ratings can be obtained with natural language processing ("AI") and accompanies the paper "*Expanding the Methodological Toolbox: Machine-Based Item Desirability Ratings as an Alternative to Human-Based Ratings*".
281
 
282
  *Hommel, B. E. (2023). Expanding the methodological toolbox: Machine-based item desirability ratings as an alternative to human-based ratings. Personality and Individual Differences, 213, 112307. https://doi.org/10.1016/j.paid.2023.112307*
283
 
284
  <small>https://www.magnolia-psychometrics.com/</small>
285
  """, unsafe_allow_html=True)
 
286
  placeholder_launch = st.empty()
287
  placeholder_summary = st.empty()
288
  placeholder_demo = st.empty()
 
82
  gender_value = gender_options.index(gender_input)
83
 
84
  expert_options = [
85
+ '[Please select]',
86
  'No, I do not have a background in social or behavioral sciences',
87
  'Yes, I have either studied social or behavioral sciences or I am currently a student in this field',
88
  'Yes, I have either worked as a researcher in the field of social or behavioral sciences or I have had past experience as a researcher in this area'
 
261
  st.divider()
262
  st.markdown("""
263
  ## Explore the data
264
+ Figures show the accuarcy in precitions of human-rated item desirability by
265
+ the sentiment model (left) and the desirability model (right), using
266
+ `test`-partition data only.
267
  """)
268
 
269
  show_covariates = st.checkbox('Show covariates', value=True)
 
272
  else:
273
  option = None
274
 
275
+ if 'df' not in st.session_state:
276
+ utils.load_data()
277
+
278
+ plot = plots.scatter_plot(st.session_state.df, option)
279
+ st.plotly_chart(plot, theme=None, use_container_width=True)
280
 
281
  def main():
282
  st.markdown("""
283
  # Machine-Based Item Desirability Ratings
284
+ This web application demonstrates how item desirability ratings can be obtained with natural language processing ("AI"), and accompanying the paper "*Expanding the Methodological Toolbox: Machine-Based Item Desirability Ratings as an Alternative to Human-Based Ratings*".
285
 
286
  *Hommel, B. E. (2023). Expanding the methodological toolbox: Machine-based item desirability ratings as an alternative to human-based ratings. Personality and Individual Differences, 213, 112307. https://doi.org/10.1016/j.paid.2023.112307*
287
 
288
  <small>https://www.magnolia-psychometrics.com/</small>
289
  """, unsafe_allow_html=True)
290
+
291
  placeholder_launch = st.empty()
292
  placeholder_summary = st.empty()
293
  placeholder_demo = st.empty()
utils.py CHANGED
@@ -12,7 +12,7 @@ id_vars = [
12
  'rater_group', 'study', 'instrument'
13
  ]
14
 
15
- if 'df' not in st.session_state:
16
  st.session_state.df = (
17
  pd
18
  .read_feather(path='data.feather')
 
12
  'rater_group', 'study', 'instrument'
13
  ]
14
 
15
+ def load_data():
16
  st.session_state.df = (
17
  pd
18
  .read_feather(path='data.feather')