Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -118,6 +118,35 @@ def get_final_score(df, selected_columns):
|
|
118 |
df.insert(1, 'Selected Score', selected_score)
|
119 |
return df
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
def get_baseline_df():
|
122 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
123 |
submission_repo.git_pull()
|
|
|
118 |
df.insert(1, 'Selected Score', selected_score)
|
119 |
return df
|
120 |
|
121 |
+
|
122 |
+
def get_final_score_quality(df, selected_columns):
|
123 |
+
normalize_df = get_normalized_df(df)
|
124 |
+
#final_score = normalize_df.drop('name', axis=1).sum(axis=1)
|
125 |
+
# for name in normalize_df.drop('Model Name (clickable)', axis=1):
|
126 |
+
# normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
|
127 |
+
quality_score = normalize_df[QUALITY_LIST].sum(axis=1) / len(QUALITY_LIST)
|
128 |
+
# quality_score = normalize_df[QUALITY_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in QUALITY_LIST])
|
129 |
+
# semantic_score = normalize_df[SEMANTIC_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in SEMANTIC_LIST ])
|
130 |
+
final_score = (quality_score * QUALITY_WEIGHT + semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
131 |
+
if 'Total Score' in df:
|
132 |
+
df['Total Score'] = final_score
|
133 |
+
else:
|
134 |
+
df.insert(1, 'Total Score', final_score)
|
135 |
+
if 'Semantic Score' in df:
|
136 |
+
df['Semantic Score'] = semantic_score
|
137 |
+
else:
|
138 |
+
df.insert(2, 'Semantic Score', semantic_score)
|
139 |
+
if 'Quality Score' in df:
|
140 |
+
df['Quality Score'] = quality_score
|
141 |
+
else:
|
142 |
+
df.insert(3, 'Quality Score', quality_score)
|
143 |
+
selected_score = calculate_selected_score(normalize_df, selected_columns)
|
144 |
+
if 'Selected Score' in df:
|
145 |
+
df['Selected Score'] = selected_score
|
146 |
+
else:
|
147 |
+
df.insert(1, 'Selected Score', selected_score)
|
148 |
+
return df
|
149 |
+
|
150 |
def get_baseline_df():
|
151 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
152 |
submission_repo.git_pull()
|