Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -71,7 +71,6 @@ def get_normalized_df(df):
|
|
71 |
for column in normalize_df.columns[1:]:
|
72 |
min_val = NORMALIZE_DIC[column]['Min']
|
73 |
max_val = NORMALIZE_DIC[column]['Max']
|
74 |
-
print(normalize_df[column], min_val, max_val)
|
75 |
normalize_df[column] = (normalize_df[column] - min_val) / (max_val - min_val)
|
76 |
return normalize_df
|
77 |
|
@@ -157,13 +156,22 @@ def get_baseline_df_quality():
|
|
157 |
df = convert_scores_to_percentage(df)
|
158 |
return df
|
159 |
|
160 |
-
def get_all_df(selected_columns):
|
161 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
162 |
submission_repo.git_pull()
|
163 |
-
df = pd.read_csv(
|
164 |
df = get_final_score(df, selected_columns)
|
165 |
df = df.sort_values(by="Selected Score", ascending=False)
|
166 |
return df
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
def convert_scores_to_percentage(df):
|
169 |
# 对DataFrame中的每一列(除了'name'列)进行操作
|
@@ -185,7 +193,7 @@ def enable_all():
|
|
185 |
return gr.update(value=TASK_INFO)
|
186 |
|
187 |
def on_filter_model_size_method_change(selected_columns):
|
188 |
-
updated_data = get_all_df(selected_columns)
|
189 |
#print(updated_data)
|
190 |
# columns:
|
191 |
selected_columns = [item for item in TASK_INFO if item in selected_columns]
|
@@ -207,7 +215,7 @@ def on_filter_model_size_method_change(selected_columns):
|
|
207 |
return filter_component#.value
|
208 |
|
209 |
def on_filter_model_size_method_change_quality(selected_columns):
|
210 |
-
updated_data =
|
211 |
#print(updated_data)
|
212 |
# columns:
|
213 |
selected_columns = [item for item in QUALITY_TAB if item in selected_columns]
|
|
|
71 |
for column in normalize_df.columns[1:]:
|
72 |
min_val = NORMALIZE_DIC[column]['Min']
|
73 |
max_val = NORMALIZE_DIC[column]['Max']
|
|
|
74 |
normalize_df[column] = (normalize_df[column] - min_val) / (max_val - min_val)
|
75 |
return normalize_df
|
76 |
|
|
|
156 |
df = convert_scores_to_percentage(df)
|
157 |
return df
|
158 |
|
159 |
+
def get_all_df(selected_columns, dir=CSV_DIR):
|
160 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
161 |
submission_repo.git_pull()
|
162 |
+
df = pd.read_csv(dir)
|
163 |
df = get_final_score(df, selected_columns)
|
164 |
df = df.sort_values(by="Selected Score", ascending=False)
|
165 |
return df
|
166 |
+
|
167 |
+
def get_all_df_quality(selected_columns, dir=QUALITY_DIR):
|
168 |
+
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
169 |
+
submission_repo.git_pull()
|
170 |
+
df = pd.read_csv(dir)
|
171 |
+
df = get_final_score_quality(df, selected_columns)
|
172 |
+
df = df.sort_values(by="Selected Score", ascending=False)
|
173 |
+
return df
|
174 |
+
|
175 |
|
176 |
def convert_scores_to_percentage(df):
|
177 |
# 对DataFrame中的每一列(除了'name'列)进行操作
|
|
|
193 |
return gr.update(value=TASK_INFO)
|
194 |
|
195 |
def on_filter_model_size_method_change(selected_columns):
|
196 |
+
updated_data = get_all_df(selected_columns, CSV_DIR)
|
197 |
#print(updated_data)
|
198 |
# columns:
|
199 |
selected_columns = [item for item in TASK_INFO if item in selected_columns]
|
|
|
215 |
return filter_component#.value
|
216 |
|
217 |
def on_filter_model_size_method_change_quality(selected_columns):
|
218 |
+
updated_data = get_all_df(selected_columns, QUALITY_DIR)
|
219 |
#print(updated_data)
|
220 |
# columns:
|
221 |
selected_columns = [item for item in QUALITY_TAB if item in selected_columns]
|