Spaces:
Running
Running
yinanhe
commited on
Commit
•
90cb6cf
1
Parent(s):
2f0b89f
[update] convert score to xx.xx%
Browse files
app.py
CHANGED
@@ -100,6 +100,7 @@ def get_baseline_df():
|
|
100 |
df = df.sort_values(by="Selected Score", ascending=False)
|
101 |
present_columns = MODEL_INFO + checkbox_group.value
|
102 |
df = df[present_columns]
|
|
|
103 |
return df
|
104 |
|
105 |
def get_all_df(selected_columns):
|
@@ -110,6 +111,14 @@ def get_all_df(selected_columns):
|
|
110 |
df = df.sort_values(by="Selected Score", ascending=False)
|
111 |
return df
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
def on_filter_model_size_method_change(selected_columns):
|
114 |
updated_data = get_all_df(selected_columns)
|
115 |
print(updated_data)
|
@@ -118,6 +127,7 @@ def on_filter_model_size_method_change(selected_columns):
|
|
118 |
present_columns = MODEL_INFO + selected_columns
|
119 |
updated_data = updated_data[present_columns]
|
120 |
updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
|
|
|
121 |
updated_headers = present_columns
|
122 |
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
|
123 |
# print(updated_data,present_columns,update_datatype)
|
|
|
100 |
df = df.sort_values(by="Selected Score", ascending=False)
|
101 |
present_columns = MODEL_INFO + checkbox_group.value
|
102 |
df = df[present_columns]
|
103 |
+
df = convert_scores_to_percentage(df)
|
104 |
return df
|
105 |
|
106 |
def get_all_df(selected_columns):
|
|
|
111 |
df = df.sort_values(by="Selected Score", ascending=False)
|
112 |
return df
|
113 |
|
114 |
+
def convert_scores_to_percentage(df):
|
115 |
+
# 对DataFrame中的每一列(除了'name'列)进行操作
|
116 |
+
for column in df.columns[1:]: # 假设第一列是'name'
|
117 |
+
df[column] = round(df[column] * 100,2) # 将分数转换为百分数
|
118 |
+
df[column] = df[column].astype(str) + '%'
|
119 |
+
return df
|
120 |
+
|
121 |
+
|
122 |
def on_filter_model_size_method_change(selected_columns):
|
123 |
updated_data = get_all_df(selected_columns)
|
124 |
print(updated_data)
|
|
|
127 |
present_columns = MODEL_INFO + selected_columns
|
128 |
updated_data = updated_data[present_columns]
|
129 |
updated_data = updated_data.sort_values(by="Selected Score", ascending=False)
|
130 |
+
updated_data = convert_scores_to_percentage(updated_data)
|
131 |
updated_headers = present_columns
|
132 |
update_datatype = [DATA_TITILE_TYPE[COLUMN_NAMES.index(x)] for x in updated_headers]
|
133 |
# print(updated_data,present_columns,update_datatype)
|