Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -122,26 +122,13 @@ def get_final_score(df, selected_columns):
|
|
122 |
|
123 |
def get_final_score_quality(df, selected_columns):
|
124 |
normalize_df = get_normalized_df(df)
|
125 |
-
|
126 |
-
|
127 |
-
# normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
|
128 |
-
quality_score = normalize_df[QUALITY_LIST].sum(axis=1) / len(QUALITY_LIST)
|
129 |
-
# quality_score = normalize_df[QUALITY_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in QUALITY_LIST])
|
130 |
-
# semantic_score = normalize_df[SEMANTIC_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in SEMANTIC_LIST ])
|
131 |
-
final_score = (quality_score * QUALITY_WEIGHT + semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
132 |
-
if 'Total Score' in df:
|
133 |
-
df['Total Score'] = final_score
|
134 |
-
else:
|
135 |
-
df.insert(1, 'Total Score', final_score)
|
136 |
-
if 'Semantic Score' in df:
|
137 |
-
df['Semantic Score'] = semantic_score
|
138 |
-
else:
|
139 |
-
df.insert(2, 'Semantic Score', semantic_score)
|
140 |
if 'Quality Score' in df:
|
141 |
df['Quality Score'] = quality_score
|
142 |
else:
|
143 |
-
df.insert(
|
144 |
-
selected_score =
|
145 |
if 'Selected Score' in df:
|
146 |
df['Selected Score'] = selected_score
|
147 |
else:
|
@@ -162,8 +149,8 @@ def get_baseline_df():
|
|
162 |
def get_baseline_df_quality():
|
163 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
164 |
submission_repo.git_pull()
|
165 |
-
df = pd.read_csv(
|
166 |
-
df =
|
167 |
df = df.sort_values(by="Selected Score", ascending=False)
|
168 |
present_columns = MODEL_INFO_TAB_QUALITY + checkbox_group_quality.value
|
169 |
df = df[present_columns]
|
@@ -220,7 +207,7 @@ def on_filter_model_size_method_change(selected_columns):
|
|
220 |
return filter_component#.value
|
221 |
|
222 |
def on_filter_model_size_method_change_quality(selected_columns):
|
223 |
-
updated_data =
|
224 |
#print(updated_data)
|
225 |
# columns:
|
226 |
selected_columns = [item for item in QUALITY_TAB if item in selected_columns]
|
|
|
122 |
|
123 |
def get_final_score_quality(df, selected_columns):
|
124 |
normalize_df = get_normalized_df(df)
|
125 |
+
quality_score = normalize_df[QUALITY_TAB].sum(axis=1) / len(QUALITY_TAB)
|
126 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
if 'Quality Score' in df:
|
128 |
df['Quality Score'] = quality_score
|
129 |
else:
|
130 |
+
df.insert(1, 'Quality Score', quality_score)
|
131 |
+
selected_score = normalize_df[selected_columns].sum(axis=1) / len(selected_columns)
|
132 |
if 'Selected Score' in df:
|
133 |
df['Selected Score'] = selected_score
|
134 |
else:
|
|
|
149 |
def get_baseline_df_quality():
|
150 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
151 |
submission_repo.git_pull()
|
152 |
+
df = pd.read_csv(QUALITY_DIR)
|
153 |
+
df = get_final_score_quality(df, checkbox_group_quality.value)
|
154 |
df = df.sort_values(by="Selected Score", ascending=False)
|
155 |
present_columns = MODEL_INFO_TAB_QUALITY + checkbox_group_quality.value
|
156 |
df = df[present_columns]
|
|
|
207 |
return filter_component#.value
|
208 |
|
209 |
def on_filter_model_size_method_change_quality(selected_columns):
|
210 |
+
updated_data = get_baseline_df_quality()
|
211 |
#print(updated_data)
|
212 |
# columns:
|
213 |
selected_columns = [item for item in QUALITY_TAB if item in selected_columns]
|