wenhuchen commited on
Commit
bb81b02
1 Parent(s): c41df2a

update the submission

Browse files
Files changed (1) hide show
  1. utils.py +23 -11
utils.py CHANGED
@@ -100,11 +100,12 @@ SUBMIT_INTRODUCTION = """# Submit on Science Leaderboard Introduction
100
 
101
  ```json
102
  {
103
- "Model Name": "Model X",
104
- "TheoremQA": 0.5,
105
- "MATH": 0.5,
106
- "GSM": 0.5
107
- "GPQA": 0.5
 
108
  }
109
  ```
110
  After submitting, you can click the "Refresh" button to see the updated leaderboard(it may takes few seconds).
@@ -125,16 +126,27 @@ def add_new_eval(
125
  return "Error! Empty file!"
126
 
127
  upload_data=json.loads(input_file)
128
- data_row = [upload_data['ModelName'], upload_data['TheoremQA'], upload_data['MATH'], upload_data['GSM'], upload_data['GPQA']]
129
 
130
  submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
131
  submission_repo.git_pull()
132
 
133
- with open(CSV_DIR, mode='a', newline='') as file:
134
- writer = csv.writer(file)
135
- writer.writerow(data_row)
136
-
137
- submission_repo.push_to_hub()
 
 
 
 
 
 
 
 
 
 
 
138
 
139
  def refresh_data():
140
  return get_df()
 
100
 
101
  ```json
102
  {
103
+ "Model": "[NAME]",
104
+ "Repo": "https://huggingface.co/[MODEL_NAME]"
105
+ "TheoremQA": 50,
106
+ "MATH": 50,
107
+ "GSM": 50
108
+ "GPQA": 50
109
  }
110
  ```
111
  After submitting, you can click the "Refresh" button to see the updated leaderboard(it may takes few seconds).
 
126
  return "Error! Empty file!"
127
 
128
  upload_data=json.loads(input_file)
129
+ data_row = [f'[{upload_data["Model"]}]({upload_data["Repo"]})', upload_data['TheoremQA'], upload_data['MATH'], upload_data['GSM'], upload_data['GPQA']]
130
 
131
  submission_repo = Repository(local_dir=SUBMISSION_NAME, clone_from=SUBMISSION_URL, use_auth_token=HF_TOKEN, repo_type="dataset")
132
  submission_repo.git_pull()
133
 
134
+ already_submitted = []
135
+ with open(CSV_DIR, mode='r') as file:
136
+ reader = csv.reader(file, delimiter=',')
137
+ for row in reader:
138
+ already_submitted.append(row[0])
139
+
140
+ if data_row[0] not in already_submitted:
141
+ with open(CSV_DIR, mode='a', newline='') as file:
142
+ writer = csv.writer(file)
143
+ writer.writerow(data_row)
144
+
145
+ submission_repo.push_to_hub()
146
+ print('Submission Successful')
147
+ else:
148
+ print('The entry already exists')
149
+
150
 
151
  def refresh_data():
152
  return get_df()