lewtun HF staff commited on
Commit
5597cc4
1 Parent(s): 5f96f95

Add dataset card for submissions

Browse files
Files changed (1) hide show
  1. app.py +26 -2
app.py CHANGED
@@ -24,6 +24,31 @@ LOGS_REPO = "submission-logs"
24
  # 1. Add check that fields are nested under `tasks` field correctly
25
  # 2. Add check that names of tasks and datasets are valid
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  ###########
29
  ### APP ###
@@ -119,8 +144,7 @@ if submit_button and submission_errors == 0:
119
  private=False,
120
  use_auth_token=HF_TOKEN,
121
  )
122
- submission_metadata = {"benchmark": "gem", "type": "prediction", "submission_name": submission_name}
123
- repo.repocard_metadata_save(submission_metadata)
124
 
125
  with open(f"{LOCAL_REPO}/submission.json", "w", encoding="utf-8") as f:
126
  json.dump(json_data, f)
 
24
  # 1. Add check that fields are nested under `tasks` field correctly
25
  # 2. Add check that names of tasks and datasets are valid
26
 
27
+ MARKDOWN = """---
28
+ benchmark: gem
29
+ type: prediction
30
+ submission_name: {submission_name}
31
+ tags:
32
+ - evaluation
33
+ - benchmark
34
+ ---
35
+ # GEM Submission
36
+
37
+ Submission name: {submission_name}
38
+
39
+ """
40
+
41
+
42
+ def generate_dataset_card(submission_name):
43
+ """
44
+ Generate dataset card for the submission
45
+ """
46
+ markdown = MARKDOWN.format(
47
+ submission_name=submission_name,
48
+ )
49
+ with open(os.path.join(LOCAL_REPO, "README.md"), "w") as f:
50
+ f.write(markdown)
51
+
52
 
53
  ###########
54
  ### APP ###
 
144
  private=False,
145
  use_auth_token=HF_TOKEN,
146
  )
147
+ generate_dataset_card(submission_name)
 
148
 
149
  with open(f"{LOCAL_REPO}/submission.json", "w", encoding="utf-8") as f:
150
  json.dump(json_data, f)