Spaces:
Runtime error
Runtime error
chore: refinement
Browse files
app.py
CHANGED
@@ -70,20 +70,21 @@ with col2:
|
|
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 |
-
st.markdown("After transformation")
|
74 |
-
# st.dataframe(df_right)
|
75 |
if "baseline" in list(df_right.keys()):
|
76 |
-
st.markdown(f"A **baseline** feature has been found on your data, do you want to merge it with
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
st.
|
86 |
-
|
|
|
|
|
|
|
87 |
elif detect_blinking and not number_of_blinks:
|
88 |
st.caption("No blinking values were found in your data!")
|
89 |
|
|
|
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 |
if "baseline" in list(df_right.keys()):
|
74 |
+
st.markdown(f"A **baseline** feature has been found on your data, do you want to merge it with any of the other features in a new calculated field?")
|
75 |
+
option = st.multiselect('Select a feature to merge', [k for k in list(df_right.keys()) if k != 'baseline'], [])
|
76 |
+
if option:
|
77 |
+
st.write('You selected:', option)
|
78 |
+
relative_key = f"relative_{option}"
|
79 |
+
add_relative = st.button(f"Add {relative_key}")
|
80 |
+
if add_relative:
|
81 |
+
baseline_mean = [sum(s)/len(s) for s in df['baseline']]
|
82 |
+
df_right['relative_pupil_dilation'] = [df['pupil_dilation'][i] - baseline_mean[i] for i in range(len(df))]
|
83 |
+
st.markdown("After adding calculated fields")
|
84 |
+
st.dataframe(df_right)
|
85 |
+
with open('myfile.csv') as f:
|
86 |
+
st.download_button('Download CSV', f)
|
87 |
+
st.info("Your data has been downloaded, you can visualize and detect outliers in the 'Plotting' and 'Detect Outliers' pages on the sidebar.")
|
88 |
elif detect_blinking and not number_of_blinks:
|
89 |
st.caption("No blinking values were found in your data!")
|
90 |
|