Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,6 +38,7 @@ def add_new_eval(
|
|
| 38 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
| 39 |
submission_repo.git_pull()
|
| 40 |
filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
|
|
|
| 41 |
now = datetime.datetime.now()
|
| 42 |
with open(f'{SUBMISSION_NAME}/{filename}.zip','wb') as f:
|
| 43 |
f.write(input_file)
|
|
@@ -103,7 +104,10 @@ def add_new_eval(
|
|
| 103 |
new_data.append("User Upload")
|
| 104 |
else:
|
| 105 |
new_data.append(team_name)
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
| 107 |
csv_data.loc[col] = new_data
|
| 108 |
csv_data = csv_data.to_csv(CSV_DIR, index=False)
|
| 109 |
submission_repo.push_to_hub()
|
|
@@ -114,7 +118,7 @@ def get_normalized_df(df):
|
|
| 114 |
# final_score = df.drop('name', axis=1).sum(axis=1)
|
| 115 |
# df.insert(1, 'Overall Score', final_score)
|
| 116 |
normalize_df = df.copy().fillna(0.0)
|
| 117 |
-
for column in normalize_df.columns[1:-
|
| 118 |
min_val = NORMALIZE_DIC[column]['Min']
|
| 119 |
max_val = NORMALIZE_DIC[column]['Max']
|
| 120 |
normalize_df[column] = (normalize_df[column] - min_val) / (max_val - min_val)
|
|
@@ -166,7 +170,7 @@ def calculate_selected_score_i2v(df, selected_columns):
|
|
| 166 |
def get_final_score(df, selected_columns):
|
| 167 |
normalize_df = get_normalized_df(df)
|
| 168 |
#final_score = normalize_df.drop('name', axis=1).sum(axis=1)
|
| 169 |
-
for name in normalize_df.drop('Model Name (clickable)', axis=1).drop('Source', axis=1).drop('Mail', axis=1):
|
| 170 |
normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
|
| 171 |
quality_score = normalize_df[QUALITY_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in QUALITY_LIST])
|
| 172 |
semantic_score = normalize_df[SEMANTIC_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in SEMANTIC_LIST ])
|
|
@@ -246,6 +250,7 @@ def get_baseline_df():
|
|
| 246 |
df = get_final_score(df, checkbox_group.value)
|
| 247 |
df = df.sort_values(by="Selected Score", ascending=False)
|
| 248 |
present_columns = MODEL_INFO + checkbox_group.value
|
|
|
|
| 249 |
df = df[present_columns]
|
| 250 |
df = convert_scores_to_percentage(df)
|
| 251 |
return df
|
|
@@ -320,7 +325,7 @@ def convert_scores_to_percentage(df):
|
|
| 320 |
# 对DataFrame中的每一列(除了'name'列)进行操作
|
| 321 |
|
| 322 |
if 'Source' in df.columns:
|
| 323 |
-
skip_col =
|
| 324 |
else:
|
| 325 |
skip_col =1
|
| 326 |
for column in df.columns[skip_col:]: # 假设第一列是'name'
|
|
@@ -649,4 +654,4 @@ with block:
|
|
| 649 |
data_run.click(on_filter_model_size_method_change, inputs=[checkbox_group], outputs=data_component)
|
| 650 |
|
| 651 |
|
| 652 |
-
block.launch()
|
|
|
|
| 38 |
submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
|
| 39 |
submission_repo.git_pull()
|
| 40 |
filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
| 41 |
+
update_time = now.strftime("%Y-%m-%d") # Capture update time
|
| 42 |
now = datetime.datetime.now()
|
| 43 |
with open(f'{SUBMISSION_NAME}/{filename}.zip','wb') as f:
|
| 44 |
f.write(input_file)
|
|
|
|
| 104 |
new_data.append("User Upload")
|
| 105 |
else:
|
| 106 |
new_data.append(team_name)
|
| 107 |
+
|
| 108 |
+
new_data.append(contact_email) # Add contact email [private]
|
| 109 |
+
new_data.append(update_time) # Add the update time
|
| 110 |
+
|
| 111 |
csv_data.loc[col] = new_data
|
| 112 |
csv_data = csv_data.to_csv(CSV_DIR, index=False)
|
| 113 |
submission_repo.push_to_hub()
|
|
|
|
| 118 |
# final_score = df.drop('name', axis=1).sum(axis=1)
|
| 119 |
# df.insert(1, 'Overall Score', final_score)
|
| 120 |
normalize_df = df.copy().fillna(0.0)
|
| 121 |
+
for column in normalize_df.columns[1:-3]:
|
| 122 |
min_val = NORMALIZE_DIC[column]['Min']
|
| 123 |
max_val = NORMALIZE_DIC[column]['Max']
|
| 124 |
normalize_df[column] = (normalize_df[column] - min_val) / (max_val - min_val)
|
|
|
|
| 170 |
def get_final_score(df, selected_columns):
|
| 171 |
normalize_df = get_normalized_df(df)
|
| 172 |
#final_score = normalize_df.drop('name', axis=1).sum(axis=1)
|
| 173 |
+
for name in normalize_df.drop('Model Name (clickable)', axis=1).drop('Source', axis=1).drop('Mail', axis=1).drop('Date',axis=1):
|
| 174 |
normalize_df[name] = normalize_df[name]*DIM_WEIGHT[name]
|
| 175 |
quality_score = normalize_df[QUALITY_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in QUALITY_LIST])
|
| 176 |
semantic_score = normalize_df[SEMANTIC_LIST].sum(axis=1)/sum([DIM_WEIGHT[i] for i in SEMANTIC_LIST ])
|
|
|
|
| 250 |
df = get_final_score(df, checkbox_group.value)
|
| 251 |
df = df.sort_values(by="Selected Score", ascending=False)
|
| 252 |
present_columns = MODEL_INFO + checkbox_group.value
|
| 253 |
+
print(present_columns)
|
| 254 |
df = df[present_columns]
|
| 255 |
df = convert_scores_to_percentage(df)
|
| 256 |
return df
|
|
|
|
| 325 |
# 对DataFrame中的每一列(除了'name'列)进行操作
|
| 326 |
|
| 327 |
if 'Source' in df.columns:
|
| 328 |
+
skip_col =3
|
| 329 |
else:
|
| 330 |
skip_col =1
|
| 331 |
for column in df.columns[skip_col:]: # 假设第一列是'name'
|
|
|
|
| 654 |
data_run.click(on_filter_model_size_method_change, inputs=[checkbox_group], outputs=data_component)
|
| 655 |
|
| 656 |
|
| 657 |
+
block.launch(server_name="0.0.0.0").queue()
|