Spaces:
Running
Running
added some clean error handling prior to model inferencing
Browse files- tab_manager.py +24 -10
tab_manager.py
CHANGED
@@ -84,9 +84,17 @@ def general_bias_eval_setup(tab, modelID, imagesTab):
|
|
84 |
hide_index=True,
|
85 |
num_rows="fixed",
|
86 |
)
|
87 |
-
|
88 |
-
|
89 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
|
91 |
if user_evaluation_variables.RUN_TIME and user_evaluation_variables.CURRENT_EVAL_TYPE == 'general':
|
92 |
GBM.output_eval_results(user_evaluation_variables.EVAL_METRICS, 21, 'general')
|
@@ -141,13 +149,19 @@ def task_oriented_bias_eval_setup(tab, modelID, imagesTab):
|
|
141 |
target = st.text_input('What is the single-token target of your task-oriented evaluation study '
|
142 |
'e.g.: "burger", "coffee", "men", "women"')
|
143 |
|
144 |
-
if
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
if user_evaluation_variables.RUN_TIME and user_evaluation_variables.CURRENT_EVAL_TYPE == 'task-oriented':
|
152 |
GBM.output_eval_results(user_evaluation_variables.EVAL_METRICS, 21, 'task-oriented')
|
153 |
taskCSVData = create_word_distribution_csv(user_evaluation_variables.EVAL_METRICS,
|
|
|
84 |
hide_index=True,
|
85 |
num_rows="fixed",
|
86 |
)
|
87 |
+
|
88 |
+
if not all([GENValTable["GEN Values"][0].isnumeric(), GENValTable["GEN Values"][1].isnumeric(), GENValTable["GEN Values"][2].isnumeric()]):
|
89 |
+
st.error('Looks like you have entered non-numeric values! '
|
90 |
+
'Please enter numeric values in the table above', icon="π¨")
|
91 |
+
elif not all([check_for_power_of_two(int(GENValTable["GEN Values"][2])), int(GENValTable["GEN Values"][2]) >= 8]):
|
92 |
+
st.error('Please ensure that your image resolution is 1 number that is to the power of 2 (greater than 8) '
|
93 |
+
'e.g. 8,16,32,64, 128 etc.', icon="π¨")
|
94 |
+
else:
|
95 |
+
if st.button('Evaluate!', key="EVAL_BUTTON_GEN"):
|
96 |
+
initiate_general_bias_evaluation(tab, modelID, [GENValTable, GENCheckTable], imagesTab)
|
97 |
+
st.rerun()
|
98 |
|
99 |
if user_evaluation_variables.RUN_TIME and user_evaluation_variables.CURRENT_EVAL_TYPE == 'general':
|
100 |
GBM.output_eval_results(user_evaluation_variables.EVAL_METRICS, 21, 'general')
|
|
|
149 |
target = st.text_input('What is the single-token target of your task-oriented evaluation study '
|
150 |
'e.g.: "burger", "coffee", "men", "women"')
|
151 |
|
152 |
+
if not all([TOValTable["TO Values"][0].isnumeric(), TOValTable["TO Values"][1].isnumeric(), TOValTable["TO Values"][2].isnumeric()]):
|
153 |
+
st.error('Looks like you have entered non-numeric values! '
|
154 |
+
'Please enter numeric values in the table above', icon="π¨")
|
155 |
+
elif not all([check_for_power_of_two(int(TOValTable["TO Values"][2])), int(TOValTable["TO Values"][2]) >= 8]):
|
156 |
+
st.error('Please ensure that your image resolution is 1 number that is to the power of 2 (greater than 8) '
|
157 |
+
'e.g. 8,16,32,64, 128 etc.', icon="π¨")
|
158 |
+
else:
|
159 |
+
if st.button('Evaluate!', key="EVAL_BUTTON_TO"):
|
160 |
+
if len(target) > 0:
|
161 |
+
initiate_task_oriented_bias_evaluation(tab, modelID, TOValTable, target, imagesTab)
|
162 |
+
st.rerun()
|
163 |
+
else:
|
164 |
+
st.error('Please input a target for your task-oriented analysis', icon="π¨")
|
165 |
if user_evaluation_variables.RUN_TIME and user_evaluation_variables.CURRENT_EVAL_TYPE == 'task-oriented':
|
166 |
GBM.output_eval_results(user_evaluation_variables.EVAL_METRICS, 21, 'task-oriented')
|
167 |
taskCSVData = create_word_distribution_csv(user_evaluation_variables.EVAL_METRICS,
|