Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ def add_new_eval(
|
|
36 |
submission_repo.git_pull()
|
37 |
filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
38 |
now = datetime.datetime.now()
|
39 |
-
with open(f'{filename}.zip','wb') as f:
|
40 |
f.write(input_file)
|
41 |
# shutil.copyfile(CSV_DIR, os.path.join(SUBMISSION_NAME, f"{input_file}"))
|
42 |
|
@@ -67,9 +67,12 @@ def add_new_eval(
|
|
67 |
for file in os.listdir(filename):
|
68 |
with open(os.path.join(filename, file)) as ff:
|
69 |
cur_json = json.load(ff)
|
|
|
70 |
if isinstance(cur_json, dict):
|
|
|
71 |
for key in cur_json:
|
72 |
upload_data[key] = cur_json[key][0]
|
|
|
73 |
# add new data
|
74 |
new_data = [
|
75 |
model_name
|
@@ -82,6 +85,7 @@ def add_new_eval(
|
|
82 |
csv_data.loc[col] = new_data
|
83 |
csv_data = csv_data.to_csv(CSV_DIR, index=False)
|
84 |
submission_repo.push_to_hub()
|
|
|
85 |
return 0
|
86 |
|
87 |
def get_normalized_df(df):
|
@@ -133,7 +137,7 @@ def calculate_selected_score_i2v(df, selected_columns):
|
|
133 |
return selected_i2v_score
|
134 |
if selected_i2v_score.isna().any().any():
|
135 |
return selected_quality_score
|
136 |
-
print(selected_i2v_score,selected_quality_score )
|
137 |
selected_score = (selected_quality_score * I2V_QUALITY_WEIGHT + selected_i2v_score * I2V_WEIGHT) / (I2V_QUALITY_WEIGHT + I2V_WEIGHT)
|
138 |
return selected_score.fillna(0.0)
|
139 |
|
|
|
36 |
submission_repo.git_pull()
|
37 |
filename = datetime.datetime.now().strftime("%Y%m%d_%H%M%S")
|
38 |
now = datetime.datetime.now()
|
39 |
+
with open(f'SUBMISSION_NAME/{filename}.zip','wb') as f:
|
40 |
f.write(input_file)
|
41 |
# shutil.copyfile(CSV_DIR, os.path.join(SUBMISSION_NAME, f"{input_file}"))
|
42 |
|
|
|
67 |
for file in os.listdir(filename):
|
68 |
with open(os.path.join(filename, file)) as ff:
|
69 |
cur_json = json.load(ff)
|
70 |
+
print(file, type(cur_json))
|
71 |
if isinstance(cur_json, dict):
|
72 |
+
print(cur_json.keys())
|
73 |
for key in cur_json:
|
74 |
upload_data[key] = cur_json[key][0]
|
75 |
+
print(f"{key}:{cur_json[key][0]}")
|
76 |
# add new data
|
77 |
new_data = [
|
78 |
model_name
|
|
|
85 |
csv_data.loc[col] = new_data
|
86 |
csv_data = csv_data.to_csv(CSV_DIR, index=False)
|
87 |
submission_repo.push_to_hub()
|
88 |
+
print("success update", model_name)
|
89 |
return 0
|
90 |
|
91 |
def get_normalized_df(df):
|
|
|
137 |
return selected_i2v_score
|
138 |
if selected_i2v_score.isna().any().any():
|
139 |
return selected_quality_score
|
140 |
+
# print(selected_i2v_score,selected_quality_score )
|
141 |
selected_score = (selected_quality_score * I2V_QUALITY_WEIGHT + selected_i2v_score * I2V_WEIGHT) / (I2V_QUALITY_WEIGHT + I2V_WEIGHT)
|
142 |
return selected_score.fillna(0.0)
|
143 |
|