Spaces:
Sleeping
Sleeping
updated to handle database inferencing
Browse files- model_comparison.py +19 -8
model_comparison.py
CHANGED
|
@@ -5,14 +5,23 @@ import plotly.express as px
|
|
| 5 |
from yaml import safe_load
|
| 6 |
import user_evaluation_variables
|
| 7 |
databaseDF = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def get_evaluation_id(evalType, debugging):
|
|
|
|
|
|
|
|
|
|
| 10 |
if evalType == 'general':
|
| 11 |
-
DFPath =
|
| 12 |
else:
|
| 13 |
-
DFPath =
|
| 14 |
-
|
| 15 |
-
|
| 16 |
evalColumn = [int(x.split('_')[1]) for x in list(df['Eval. ID'])]
|
| 17 |
|
| 18 |
newEvalID = max(evalColumn) + 1
|
|
@@ -73,6 +82,8 @@ def add_user_evalID_columns_to_df(df, evalDataPath, personalFLAG):
|
|
| 73 |
return df
|
| 74 |
def initialise_page(tab):
|
| 75 |
global databaseDF
|
|
|
|
|
|
|
| 76 |
with tab:
|
| 77 |
c1, c2 = st.columns(2)
|
| 78 |
with c1:
|
|
@@ -82,12 +93,12 @@ def initialise_page(tab):
|
|
| 82 |
communityGEN = st.form_submit_button("TBYB Community Evaluations")
|
| 83 |
if personalGEN:
|
| 84 |
databaseDF = None
|
| 85 |
-
databaseDF = add_user_evalID_columns_to_df(databaseDF,
|
| 86 |
"Objects", "Actions", "Occupations", "Dist. Bias", "Hallucination", "Gen. Miss Rate",
|
| 87 |
"Run Time", "Date", "Time"]]
|
| 88 |
if communityGEN:
|
| 89 |
databaseDF = None
|
| 90 |
-
databaseDF = add_user_evalID_columns_to_df(databaseDF,
|
| 91 |
"Objects", "Actions", "Occupations", "Dist. Bias", "Hallucination", "Gen. Miss Rate",
|
| 92 |
"Run Time", "Date", "Time"]]
|
| 93 |
with c2:
|
|
@@ -97,11 +108,11 @@ def initialise_page(tab):
|
|
| 97 |
communityTASK = st.form_submit_button("TBYB Community Evaluations")
|
| 98 |
if personalTASK:
|
| 99 |
databaseDF = None
|
| 100 |
-
databaseDF = add_user_evalID_columns_to_df(databaseDF,
|
| 101 |
"Target", "Dist. Bias", "Hallucination", "Gen. Miss Rate", "Run Time", "Date", "Time"]]
|
| 102 |
if communityTASK:
|
| 103 |
databaseDF = None
|
| 104 |
-
databaseDF = add_user_evalID_columns_to_df(databaseDF,
|
| 105 |
"Target", "Dist. Bias", "Hallucination", "Gen. Miss Rate", "Run Time", "Date", "Time"]]
|
| 106 |
if databaseDF is not None:
|
| 107 |
selection = dataframe_with_selections(databaseDF)
|
|
|
|
| 5 |
from yaml import safe_load
|
| 6 |
import user_evaluation_variables
|
| 7 |
databaseDF = None
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
EVAL_DATABASE_DIR = Path("data")
|
| 10 |
+
EVAL_DATABASE_DIR.mkdir(parents=True, exist_ok=True)
|
| 11 |
+
|
| 12 |
+
GEN_EVAL_DATABASE_PATH = EVAL_DATABASE_DIR / f"general_eval_database.yaml"
|
| 13 |
+
TASK_EVAL_DATABASE_PATH = EVAL_DATABASE_DIR / f"task_oriented_eval_database.yaml"
|
| 14 |
|
| 15 |
def get_evaluation_id(evalType, debugging):
|
| 16 |
+
global GEN_EVAL_DATABASE_PATH
|
| 17 |
+
global TASK_EVAL_DATABASE_PATH
|
| 18 |
+
|
| 19 |
if evalType == 'general':
|
| 20 |
+
DFPath = GEN_EVAL_DATABASE_PATH
|
| 21 |
else:
|
| 22 |
+
DFPath = TASK_EVAL_DATABASE_PATH
|
| 23 |
+
|
| 24 |
+
df = add_user_evalID_columns_to_df(None, DFPath, False)
|
| 25 |
evalColumn = [int(x.split('_')[1]) for x in list(df['Eval. ID'])]
|
| 26 |
|
| 27 |
newEvalID = max(evalColumn) + 1
|
|
|
|
| 82 |
return df
|
| 83 |
def initialise_page(tab):
|
| 84 |
global databaseDF
|
| 85 |
+
global GEN_EVAL_DATABASE_PATH
|
| 86 |
+
global TASK_EVAL_DATABASE_PATH
|
| 87 |
with tab:
|
| 88 |
c1, c2 = st.columns(2)
|
| 89 |
with c1:
|
|
|
|
| 93 |
communityGEN = st.form_submit_button("TBYB Community Evaluations")
|
| 94 |
if personalGEN:
|
| 95 |
databaseDF = None
|
| 96 |
+
databaseDF = add_user_evalID_columns_to_df(databaseDF, GEN_EVAL_DATABASE_PATH,True)[["User", "Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
| 97 |
"Objects", "Actions", "Occupations", "Dist. Bias", "Hallucination", "Gen. Miss Rate",
|
| 98 |
"Run Time", "Date", "Time"]]
|
| 99 |
if communityGEN:
|
| 100 |
databaseDF = None
|
| 101 |
+
databaseDF = add_user_evalID_columns_to_df(databaseDF, GEN_EVAL_DATABASE_PATH, False)[["User", "Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
| 102 |
"Objects", "Actions", "Occupations", "Dist. Bias", "Hallucination", "Gen. Miss Rate",
|
| 103 |
"Run Time", "Date", "Time"]]
|
| 104 |
with c2:
|
|
|
|
| 108 |
communityTASK = st.form_submit_button("TBYB Community Evaluations")
|
| 109 |
if personalTASK:
|
| 110 |
databaseDF = None
|
| 111 |
+
databaseDF = add_user_evalID_columns_to_df(databaseDF, TASK_EVAL_DATABASE_PATH, True)[["User", "Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
| 112 |
"Target", "Dist. Bias", "Hallucination", "Gen. Miss Rate", "Run Time", "Date", "Time"]]
|
| 113 |
if communityTASK:
|
| 114 |
databaseDF = None
|
| 115 |
+
databaseDF = add_user_evalID_columns_to_df(databaseDF, TASK_EVAL_DATABASE_PATH,False)[["User", "Eval. ID", "Model", "Model Type", "Resolution", "No. Samples", "Inference Steps",
|
| 116 |
"Target", "Dist. Bias", "Hallucination", "Gen. Miss Rate", "Run Time", "Date", "Time"]]
|
| 117 |
if databaseDF is not None:
|
| 118 |
selection = dataframe_with_selections(databaseDF)
|