Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,6 +84,7 @@ def calculate_selected_score(df, selected_columns):
|
|
| 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 |
|
|
@@ -140,6 +141,17 @@ def convert_scores_to_percentage(df):
|
|
| 140 |
df[column] = df[column].astype(str) + '%'
|
| 141 |
return df
|
| 142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
|
| 144 |
def on_filter_model_size_method_change(selected_columns):
|
| 145 |
updated_data = get_all_df(selected_columns)
|
|
@@ -184,14 +196,23 @@ with block:
|
|
| 184 |
gr.Markdown(
|
| 185 |
TABLE_INTRODUCTION
|
| 186 |
)
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 195 |
|
| 196 |
data_component = gr.components.Dataframe(
|
| 197 |
value=get_baseline_df,
|
|
|
|
| 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 |
|
|
|
|
| 141 |
df[column] = df[column].astype(str) + '%'
|
| 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)
|
|
|
|
| 196 |
gr.Markdown(
|
| 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 |
+
choosen_q.click(choose_all_quailty, inputs=None, outputs=[checkbox_group, data_component])
|
| 206 |
+
choosen_s.click(choose_all_semantic, inputs=None, outputs=[checkbox_group, data_component])
|
| 207 |
+
enable_b.click(enable_all, inputs=None, outputs=[checkbox_group, data_component])
|
| 208 |
+
disable_b.click(disable_all, inputs=None, outputs=[checkbox_group, data_component])
|
| 209 |
+
# selection for column part:
|
| 210 |
+
checkbox_group = gr.CheckboxGroup(
|
| 211 |
+
choices=TASK_INFO,
|
| 212 |
+
value=DEFAULT_INFO,
|
| 213 |
+
label="Evaluation Dimension",
|
| 214 |
+
interactive=True,
|
| 215 |
+
)
|
| 216 |
|
| 217 |
data_component = gr.components.Dataframe(
|
| 218 |
value=get_baseline_df,
|