laverdes commited on
Commit
275f86e
1 Parent(s): 5502743

fix: download button

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -69,6 +69,7 @@ with col2:
69
  df_right = st.session_state.df.copy(deep=True)
70
  df_right.pupil_dilation = df_right.pupil_dilation.map(lambda ser: [f for f in ser if f != 0.0])
71
  df_right.baseline = df_right.baseline.map(lambda ser: [f for f in ser if f != 0.0])
 
72
  st.success("Blinking values have been removed!")
73
  elif detect_blinking and not number_of_blinks:
74
  st.caption("No blinking values were found in your data!")
@@ -86,8 +87,7 @@ with col2:
86
  df_right[relative_key] = [[field_value - baseline_mean[i] for field_value in df_right[option[0]][i]] for i in range(len(df_right))]
87
  st.markdown("After adding calculated fields")
88
  st.dataframe(df_right)
89
- with open('myfile.csv') as f:
90
- st.download_button('Download CSV', f)
91
  st.info("Your data has been downloaded, you can visualize and detect outliers in the 'Plotting' and 'Detect Outliers' pages on the sidebar.")
92
 
93
  if not df_base.empty:
 
69
  df_right = st.session_state.df.copy(deep=True)
70
  df_right.pupil_dilation = df_right.pupil_dilation.map(lambda ser: [f for f in ser if f != 0.0])
71
  df_right.baseline = df_right.baseline.map(lambda ser: [f for f in ser if f != 0.0])
72
+ st.session_state['df'] = df_right.copy(deep=True)
73
  st.success("Blinking values have been removed!")
74
  elif detect_blinking and not number_of_blinks:
75
  st.caption("No blinking values were found in your data!")
 
87
  df_right[relative_key] = [[field_value - baseline_mean[i] for field_value in df_right[option[0]][i]] for i in range(len(df_right))]
88
  st.markdown("After adding calculated fields")
89
  st.dataframe(df_right)
90
+ st.download_button('Download CSV', df_right.to_csv("myfile.csv"))
 
91
  st.info("Your data has been downloaded, you can visualize and detect outliers in the 'Plotting' and 'Detect Outliers' pages on the sidebar.")
92
 
93
  if not df_base.empty: