ynhe commited on
Commit
22762e5
1 Parent(s): 465a9c5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -16
app.py CHANGED
@@ -80,11 +80,11 @@ 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 is None:
84
  return selected_semantic_score
85
- if selected_semantic_score is None:
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
  return selected_score
90
 
@@ -142,16 +142,16 @@ def convert_scores_to_percentage(df):
142
  return df
143
 
144
  def choose_all_quailty():
145
- return gr.update(choices=QUALITY_LIST), QUALITY_LIST
146
 
147
  def choose_all_semantic():
148
- return gr.update(choices=SEMANTIC_LIST),SEMANTIC_LIST
149
 
150
  def disable_all():
151
- return gr.update(choices=[]),[]
152
 
153
  def enable_all():
154
- return gr.update(choices=TASK_INFO),TASK_INFO
155
 
156
  def on_filter_model_size_method_change(selected_columns):
157
  updated_data = get_all_df(selected_columns)
@@ -197,19 +197,20 @@ with block:
197
  TABLE_INTRODUCTION
198
  )
199
  with gr.Row():
200
- with gr.Column():
201
  choosen_q = gr.Button("Select ALL Quality")
202
  choosen_s = gr.Button("Select ALL Semantic")
203
  enable_b = gr.Button("Select All")
204
  disable_b = gr.Button("Deselect All")
205
-
206
- # selection for column part:
207
- checkbox_group = gr.CheckboxGroup(
208
- choices=TASK_INFO,
209
- value=DEFAULT_INFO,
210
- label="Evaluation Dimension",
211
- interactive=True,
212
- )
 
213
 
214
  data_component = gr.components.Dataframe(
215
  value=get_baseline_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():
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
  return selected_score
90
 
 
142
  return df
143
 
144
  def choose_all_quailty():
145
+ return gr.update(value=QUALITY_LIST), QUALITY_LIST
146
 
147
  def choose_all_semantic():
148
+ return gr.update(value=SEMANTIC_LIST),SEMANTIC_LIST
149
 
150
  def disable_all():
151
+ return gr.update(value=[]),[]
152
 
153
  def enable_all():
154
+ return gr.update(value=TASK_INFO),TASK_INFO
155
 
156
  def on_filter_model_size_method_change(selected_columns):
157
  updated_data = get_all_df(selected_columns)
 
197
  TABLE_INTRODUCTION
198
  )
199
  with gr.Row():
200
+ with gr.Column(scale=0.2):
201
  choosen_q = gr.Button("Select ALL Quality")
202
  choosen_s = gr.Button("Select ALL Semantic")
203
  enable_b = gr.Button("Select All")
204
  disable_b = gr.Button("Deselect All")
205
+
206
+ with gr.Column(scale=0.8):
207
+ # selection for column part:
208
+ checkbox_group = gr.CheckboxGroup(
209
+ choices=TASK_INFO,
210
+ value=DEFAULT_INFO,
211
+ label="Evaluation Dimension",
212
+ interactive=True,
213
+ )
214
 
215
  data_component = gr.components.Dataframe(
216
  value=get_baseline_df,