Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -80,17 +80,16 @@ def calculate_selected_score(df, selected_columns):
|
|
| 80 |
selected_SEMANTIC = [i for i in selected_columns if i in SEMANTIC_LIST]
|
| 81 |
selected_quality_score = df[selected_QUALITY].sum(axis=1)/sum([DIM_WEIGHT[i] for i in selected_QUALITY])
|
| 82 |
selected_semantic_score = df[selected_SEMANTIC].sum(axis=1)/sum([DIM_WEIGHT[i] for i in selected_SEMANTIC ])
|
|
|
|
|
|
|
|
|
|
| 83 |
if selected_quality_score.isna().any().any():
|
| 84 |
return selected_semantic_score
|
| 85 |
if selected_semantic_score.isna().any().any():
|
| 86 |
return selected_quality_score
|
| 87 |
# print(selected_semantic_score,selected_quality_score )
|
| 88 |
selected_score = (selected_quality_score * QUALITY_WEIGHT + selected_semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
| 89 |
-
|
| 90 |
-
if selected_score.isna().any().any():
|
| 91 |
-
selected_score = [0.0 for _ in range(len(selected_score))]
|
| 92 |
-
print( selected_score.isna().any().any(),selected_score)
|
| 93 |
-
return selected_score
|
| 94 |
|
| 95 |
def get_final_score(df, selected_columns):
|
| 96 |
normalize_df = get_normalized_df(df)
|
|
|
|
| 80 |
selected_SEMANTIC = [i for i in selected_columns if i in SEMANTIC_LIST]
|
| 81 |
selected_quality_score = df[selected_QUALITY].sum(axis=1)/sum([DIM_WEIGHT[i] for i in selected_QUALITY])
|
| 82 |
selected_semantic_score = df[selected_SEMANTIC].sum(axis=1)/sum([DIM_WEIGHT[i] for i in selected_SEMANTIC ])
|
| 83 |
+
if selected_quality_score.isna().any().any() and selected_semantic_score.isna().any().any():
|
| 84 |
+
selected_score = (selected_quality_score * QUALITY_WEIGHT + selected_semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
| 85 |
+
return selected_score.fillna(0.0)
|
| 86 |
if selected_quality_score.isna().any().any():
|
| 87 |
return selected_semantic_score
|
| 88 |
if selected_semantic_score.isna().any().any():
|
| 89 |
return selected_quality_score
|
| 90 |
# print(selected_semantic_score,selected_quality_score )
|
| 91 |
selected_score = (selected_quality_score * QUALITY_WEIGHT + selected_semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
|
| 92 |
+
return selected_score.fillna(0.0)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
def get_final_score(df, selected_columns):
|
| 95 |
normalize_df = get_normalized_df(df)
|