ynhe commited on
Commit
56c9bdf
1 Parent(s): 649782b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -0
app.py CHANGED
@@ -80,6 +80,10 @@ 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
  selected_score = (selected_quality_score * QUALITY_WEIGHT + selected_semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
84
  return selected_score
85
 
 
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 is None:
84
+ return selected_semantic_score
85
+ if selected_semantic_score is None:
86
+ return selected_quality_score
87
  selected_score = (selected_quality_score * QUALITY_WEIGHT + selected_semantic_score * SEMANTIC_WEIGHT) / (QUALITY_WEIGHT + SEMANTIC_WEIGHT)
88
  return selected_score
89