Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -94,28 +94,28 @@ def main():
|
|
94 |
uploaded_file = st.file_uploader("Select a file containing MAF application pre-filtering data (see instructions in the sidebar)")
|
95 |
|
96 |
if uploaded_file is not None:
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
|
117 |
-
|
118 |
-
|
119 |
|
120 |
|
121 |
else:
|
|
|
94 |
uploaded_file = st.file_uploader("Select a file containing MAF application pre-filtering data (see instructions in the sidebar)")
|
95 |
|
96 |
if uploaded_file is not None:
|
97 |
+
try:
|
98 |
+
if not st.session_state['data_processed']:
|
99 |
+
st.session_state['df'] = process_data(uploaded_file, sens_level)
|
100 |
+
st.session_state['data_processed'] = True
|
101 |
+
|
102 |
+
df = st.session_state['df']
|
103 |
+
|
104 |
+
# Get the current date
|
105 |
+
current_datetime = datetime.now().strftime('%d-%m-%Y_%H-%M-%S')
|
106 |
+
output_filename = 'processed_applications_'+current_datetime+'.csv'
|
107 |
+
|
108 |
+
output_file = 'processed_applications.csv'
|
109 |
+
df.to_csv(output_file, index=False)
|
110 |
+
st.download_button(
|
111 |
+
label="Download data as CSV",
|
112 |
+
data=open(output_file, 'rb'),
|
113 |
+
file_name=output_filename,
|
114 |
+
mime='text/csv',
|
115 |
+
)
|
116 |
|
117 |
+
except:
|
118 |
+
st.error("Failed to process the file. Please ensure your column names match the template file.")
|
119 |
|
120 |
|
121 |
else:
|