JVice commited on
Commit
ed48666
1 Parent(s): 5bcd188

Added st.info and st.success outputs and fixed error where 'download_data' button appeared if there was no data.

Browse files
Files changed (1) hide show
  1. tab_manager.py +20 -10
tab_manager.py CHANGED
@@ -93,14 +93,19 @@ def general_bias_eval_setup(tab, modelID, imagesTab):
93
  genCSVData = create_word_distribution_csv(user_evaluation_variables.EVAL_METRICS,
94
  user_evaluation_variables.EVAL_ID,
95
  'general')
 
96
  st.write("\U0001F553 Time Taken: ", user_evaluation_variables.RUN_TIME)
97
- saveEvalsButton = st.button("Save + Upload Evaluations", key='SAVE_EVAL_GEN')
98
- st.download_button(label="Download Object Distribution data", data=genCSVData, key='SAVE_TOP_GEN',
99
- file_name=user_evaluation_variables.EVAL_ID + '_general' + '_word_distribution.csv',
100
- mime='text/csv')
101
 
 
 
 
 
 
 
102
  if saveEvalsButton:
103
- st.write("Saving and uploading evaluations")
104
  user_evaluation_variables.update_evaluation_table('general',False)
105
  user_evaluation_variables.reset_variables('general')
106
 
@@ -148,14 +153,19 @@ def task_oriented_bias_eval_setup(tab, modelID, imagesTab):
148
  taskCSVData = create_word_distribution_csv(user_evaluation_variables.EVAL_METRICS,
149
  user_evaluation_variables.EVAL_ID,
150
  user_evaluation_variables.TASK_TARGET)
 
151
  st.write("\U0001F553 Time Taken: ", user_evaluation_variables.RUN_TIME)
152
- saveEvalsButton = st.button("Save + Upload Evaluations", key='SAVE_EVAL_TASK')
153
- st.download_button(label="Download Object Distribution data", data=taskCSVData, key='SAVE_TOP_TASK',
154
- file_name=user_evaluation_variables.EVAL_ID+'_'+user_evaluation_variables.TASK_TARGET+'_word_distribution.csv',
155
- mime='text/csv')
156
 
 
 
 
 
 
 
157
  if saveEvalsButton:
158
- st.write("Saving and uploading evaluations")
159
  user_evaluation_variables.update_evaluation_table('task-oriented', False)
160
  user_evaluation_variables.reset_variables('task-oriented')
161
 
 
93
  genCSVData = create_word_distribution_csv(user_evaluation_variables.EVAL_METRICS,
94
  user_evaluation_variables.EVAL_ID,
95
  'general')
96
+
97
  st.write("\U0001F553 Time Taken: ", user_evaluation_variables.RUN_TIME)
98
+ st.info("Make sure to download your object distribution data first before saving and uploading your evaluation results."
99
+ "\n Evaluation results are cleared and refreshed after uploading." , icon="ℹ️")
 
 
100
 
101
+ if user_evaluation_variables.EVAL_ID is not None:
102
+ st.download_button(label="Download Object Distribution data", data=genCSVData, key='SAVE_TOP_GEN',
103
+ file_name=user_evaluation_variables.EVAL_ID + '_general' + '_word_distribution.csv',
104
+ mime='text/csv')
105
+
106
+ saveEvalsButton = st.button("Save + Upload Evaluations", key='SAVE_EVAL_GEN')
107
  if saveEvalsButton:
108
+ st.success("Saved and uploaded evaluations!", icon="✅")
109
  user_evaluation_variables.update_evaluation_table('general',False)
110
  user_evaluation_variables.reset_variables('general')
111
 
 
153
  taskCSVData = create_word_distribution_csv(user_evaluation_variables.EVAL_METRICS,
154
  user_evaluation_variables.EVAL_ID,
155
  user_evaluation_variables.TASK_TARGET)
156
+
157
  st.write("\U0001F553 Time Taken: ", user_evaluation_variables.RUN_TIME)
158
+ st.info("Make sure to download your object distribution data first before saving and uploading your evaluation results."
159
+ "\n Evaluation results are cleared and refreshed after uploading." , icon="ℹ️")
 
 
160
 
161
+ if user_evaluation_variables.EVAL_ID is not None:
162
+ st.download_button(label="Download Object Distribution data", data=taskCSVData, key='SAVE_TOP_TASK',
163
+ file_name=user_evaluation_variables.EVAL_ID+'_'+user_evaluation_variables.TASK_TARGET+'_word_distribution.csv',
164
+ mime='text/csv')
165
+
166
+ saveEvalsButton = st.button("Save + Upload Evaluations", key='SAVE_EVAL_TASK')
167
  if saveEvalsButton:
168
+ st.success("Saved and uploaded evaluations!", icon="✅")
169
  user_evaluation_variables.update_evaluation_table('task-oriented', False)
170
  user_evaluation_variables.reset_variables('task-oriented')
171