Spaces:
Sleeping
Sleeping
More changes to user input table.
Browse files- tab_manager.py +18 -12
tab_manager.py
CHANGED
|
@@ -17,7 +17,6 @@ def completed_setup(tabs, modelID):
|
|
| 17 |
with tabs[0]:
|
| 18 |
st.write("\U0001F917 ", modelID, " has been loaded!")
|
| 19 |
st.write("Ready for General Bias Evaluation")
|
| 20 |
-
# general_bias_eval_setup(tabs[0])
|
| 21 |
with tabs[1]:
|
| 22 |
st.write("\U0001F917 ", modelID, " has been loaded!")
|
| 23 |
st.write("Ready for Task-Oriented Bias Evaluation")
|
|
@@ -25,8 +24,6 @@ def completed_setup(tabs, modelID):
|
|
| 25 |
if not all([user_evaluation_variables.OBJECT_IMAGES_IN_UI, user_evaluation_variables.OCCUPATION_IMAGES_IN_UI, user_evaluation_variables.TASK_IMAGES_IN_UI]):
|
| 26 |
st.write("\U0001F917 ", modelID, " has been loaded!")
|
| 27 |
st.write("Waiting for Images to be generated.")
|
| 28 |
-
# if any([user_evaluation_variables.OBJECT_IMAGES_IN_UI, user_evaluation_variables.OCCUPATION_IMAGES_IN_UI,
|
| 29 |
-
# user_evaluation_variables.TASK_IMAGES_IN_UI]):
|
| 30 |
update_images_tab(tabs[3])
|
| 31 |
with tabs[0]:
|
| 32 |
general_bias_eval_setup(tabs[0], modelID, tabs[3])
|
|
@@ -36,8 +33,9 @@ def general_bias_eval_setup(tab, modelID, imagesTab):
|
|
| 36 |
|
| 37 |
generalBiasSetupDF_EVAL = pd.DataFrame(
|
| 38 |
{
|
| 39 |
-
"GEN Eval. Variable": ["No. Images to Generate per prompt", "No. Inference Steps",
|
| 40 |
-
|
|
|
|
| 41 |
}
|
| 42 |
)
|
| 43 |
generalBiasSetupDF_TYPE = pd.DataFrame(
|
|
@@ -84,13 +82,16 @@ def general_bias_eval_setup(tab, modelID, imagesTab):
|
|
| 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
|
| 93 |
-
'e.g.
|
| 94 |
else:
|
| 95 |
if st.button('Evaluate!', key="EVAL_BUTTON_GEN"):
|
| 96 |
initiate_general_bias_evaluation(tab, modelID, [GENValTable, GENCheckTable], imagesTab)
|
|
@@ -120,8 +121,9 @@ def general_bias_eval_setup(tab, modelID, imagesTab):
|
|
| 120 |
def task_oriented_bias_eval_setup(tab, modelID, imagesTab):
|
| 121 |
biasSetupDF_EVAL = pd.DataFrame(
|
| 122 |
{
|
| 123 |
-
"TO Eval. Variable": ["No. Images to Generate per prompt", "No. Inference Steps",
|
| 124 |
-
|
|
|
|
| 125 |
}
|
| 126 |
)
|
| 127 |
with tab:
|
|
@@ -146,6 +148,10 @@ def task_oriented_bias_eval_setup(tab, modelID, imagesTab):
|
|
| 146 |
hide_index=True,
|
| 147 |
num_rows="fixed",
|
| 148 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|
|
@@ -153,8 +159,8 @@ def task_oriented_bias_eval_setup(tab, modelID, imagesTab):
|
|
| 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
|
| 157 |
-
'e.g.
|
| 158 |
else:
|
| 159 |
if st.button('Evaluate!', key="EVAL_BUTTON_TO"):
|
| 160 |
if len(target) > 0:
|
|
|
|
| 17 |
with tabs[0]:
|
| 18 |
st.write("\U0001F917 ", modelID, " has been loaded!")
|
| 19 |
st.write("Ready for General Bias Evaluation")
|
|
|
|
| 20 |
with tabs[1]:
|
| 21 |
st.write("\U0001F917 ", modelID, " has been loaded!")
|
| 22 |
st.write("Ready for Task-Oriented Bias Evaluation")
|
|
|
|
| 24 |
if not all([user_evaluation_variables.OBJECT_IMAGES_IN_UI, user_evaluation_variables.OCCUPATION_IMAGES_IN_UI, user_evaluation_variables.TASK_IMAGES_IN_UI]):
|
| 25 |
st.write("\U0001F917 ", modelID, " has been loaded!")
|
| 26 |
st.write("Waiting for Images to be generated.")
|
|
|
|
|
|
|
| 27 |
update_images_tab(tabs[3])
|
| 28 |
with tabs[0]:
|
| 29 |
general_bias_eval_setup(tabs[0], modelID, tabs[3])
|
|
|
|
| 33 |
|
| 34 |
generalBiasSetupDF_EVAL = pd.DataFrame(
|
| 35 |
{
|
| 36 |
+
"GEN Eval. Variable": ["No. Images to Generate per prompt", "No. Inference Steps",
|
| 37 |
+
"Image Size - must be a value that is 2 to the power of N"],
|
| 38 |
+
"GEN Values": ["2", "10", "512"],
|
| 39 |
}
|
| 40 |
)
|
| 41 |
generalBiasSetupDF_TYPE = pd.DataFrame(
|
|
|
|
| 82 |
hide_index=True,
|
| 83 |
num_rows="fixed",
|
| 84 |
)
|
| 85 |
+
st.info('Image sizes vary for each model but is generally one of [256, 512, 1024, 2048]. We found that for some models '
|
| 86 |
+
'lower image resolutions resulted in noise outputs (you are more than welcome to experiment with this). '
|
| 87 |
+
'Consult the model card if you are unsure what image resolution to use. Rectangular '
|
| 88 |
+
'image sizes will be supported soon \U0001F601.', icon="βΉοΈ")
|
| 89 |
if not all([GENValTable["GEN Values"][0].isnumeric(), GENValTable["GEN Values"][1].isnumeric(), GENValTable["GEN Values"][2].isnumeric()]):
|
| 90 |
st.error('Looks like you have entered non-numeric values! '
|
| 91 |
'Please enter numeric values in the table above', icon="π¨")
|
| 92 |
elif not all([check_for_power_of_two(int(GENValTable["GEN Values"][2])), int(GENValTable["GEN Values"][2]) >= 8]):
|
| 93 |
+
st.error('Please ensure that your image resolution is 1 number that is 2 to the power of N (greater than 8) '
|
| 94 |
+
'e.g. 128, 256, 512, ..., etc. Lower image resolutions may result in noisy output images', icon="π¨")
|
| 95 |
else:
|
| 96 |
if st.button('Evaluate!', key="EVAL_BUTTON_GEN"):
|
| 97 |
initiate_general_bias_evaluation(tab, modelID, [GENValTable, GENCheckTable], imagesTab)
|
|
|
|
| 121 |
def task_oriented_bias_eval_setup(tab, modelID, imagesTab):
|
| 122 |
biasSetupDF_EVAL = pd.DataFrame(
|
| 123 |
{
|
| 124 |
+
"TO Eval. Variable": ["No. Images to Generate per prompt", "No. Inference Steps",
|
| 125 |
+
"Image Size - must be a value that is 2 to the power of N"],
|
| 126 |
+
"TO Values": ["2", "10", "512"],
|
| 127 |
}
|
| 128 |
)
|
| 129 |
with tab:
|
|
|
|
| 148 |
hide_index=True,
|
| 149 |
num_rows="fixed",
|
| 150 |
)
|
| 151 |
+
st.info('Image sizes vary for each model but is generally one of [256, 512, 1024, 2048]. We found that for some models '
|
| 152 |
+
'lower image resolutions resulted in noise outputs (you are more than welcome to experiment with this). '
|
| 153 |
+
'Consult the model card if you are unsure what image resolution to use. Rectangular '
|
| 154 |
+
'image sizes will be supported soon \U0001F601.', icon="βΉοΈ")
|
| 155 |
target = st.text_input('What is the single-token target of your task-oriented evaluation study '
|
| 156 |
'e.g.: "burger", "coffee", "men", "women"')
|
| 157 |
|
|
|
|
| 159 |
st.error('Looks like you have entered non-numeric values! '
|
| 160 |
'Please enter numeric values in the table above', icon="π¨")
|
| 161 |
elif not all([check_for_power_of_two(int(TOValTable["TO Values"][2])), int(TOValTable["TO Values"][2]) >= 8]):
|
| 162 |
+
st.error('Please ensure that your image resolution is 1 number that is 2 to the power of N (greater than 8) '
|
| 163 |
+
'e.g. 128, 256, 512, ..., etc. Lower image resolutions may result in noisy output images', icon="π¨")
|
| 164 |
else:
|
| 165 |
if st.button('Evaluate!', key="EVAL_BUTTON_TO"):
|
| 166 |
if len(target) > 0:
|