lewtun
HF staff
commited on
Commit
bdd92c6
1 Parent(s): 799efa5

Refactor submission format

Browse files
Files changed (2) hide show
  1. app.py +10 -9
  2. requirements.txt +0 -1
app.py CHANGED
@@ -3,8 +3,8 @@ from datetime import datetime
3
  from pathlib import Path
4
  from re import sub
5
 
6
- import pandas as pd
7
  import numpy as np
 
8
  import requests
9
  import streamlit as st
10
  from datasets import get_dataset_config_names
@@ -37,7 +37,7 @@ def download_submissions():
37
 
38
  for dataset in all_datasets:
39
  tags = extract_tags(dataset)
40
- if tags.get("benchmark") == "ought/raft" and tags.get("type") == "evaluation":
41
  submissions.append(dataset)
42
  return submissions
43
 
@@ -49,16 +49,18 @@ def format_submissions(submissions):
49
  # The following picks the latest submissions which adhere to the model card schema
50
  for submission in submissions:
51
  submission_id = submission["id"]
 
52
  response = requests.get(
53
  f"http://huggingface.co/api/datasets/{submission_id}?full=true",
54
  headers=header,
55
  )
56
  data = response.json()
57
  card_data = data["card_data"]
58
- submission_name = card_data["submission_dataset"]
59
- submission_data["Submission"].append(submission_name)
60
  submission_id = card_data["submission_id"]
61
- timestamp = submission_id.split("-")[-1]
 
 
62
  timestamp = pd.to_datetime(int(timestamp))
63
  submission_data["Date"].append(datetime.date(timestamp))
64
 
@@ -97,7 +99,6 @@ To submit to RAFT, follow the instruction posted on [this page](https://github.c
97
  )
98
  submissions = download_submissions()
99
  df = format_submissions(submissions)
100
- # hack to remove index column from https://github.com/streamlit/streamlit/issues/641
101
- # st.table(df.assign(hack="").set_index("hack").style.format(precision=3))
102
- # st.table(df.assign(hack="").set_index("hack").style.format({task: "{:.3f}" for task in FORMATTED_TASK_NAMES}))
103
- st.table(df.assign(hack="").set_index("hack"))
3
  from pathlib import Path
4
  from re import sub
5
 
 
6
  import numpy as np
7
+ import pandas as pd
8
  import requests
9
  import streamlit as st
10
  from datasets import get_dataset_config_names
37
 
38
  for dataset in all_datasets:
39
  tags = extract_tags(dataset)
40
+ if tags.get("benchmark") == "raft" and tags.get("type") == "evaluation":
41
  submissions.append(dataset)
42
  return submissions
43
 
49
  # The following picks the latest submissions which adhere to the model card schema
50
  for submission in submissions:
51
  submission_id = submission["id"]
52
+ print(submission_id)
53
  response = requests.get(
54
  f"http://huggingface.co/api/datasets/{submission_id}?full=true",
55
  headers=header,
56
  )
57
  data = response.json()
58
  card_data = data["card_data"]
59
+ username = card_data["submission_dataset"].split("/")[0]
 
60
  submission_id = card_data["submission_id"]
61
+ submission_name, sha, timestamp = submission_id.split("__")
62
+ submission = username + "\n" + submission_name
63
+ submission_data["Submission"].append(submission)
64
  timestamp = pd.to_datetime(int(timestamp))
65
  submission_data["Date"].append(datetime.date(timestamp))
66
 
99
  )
100
  submissions = download_submissions()
101
  df = format_submissions(submissions)
102
+ st.table(df.style.set_precision(3).set_properties(**{"white-space": "pre-wrap", "text-align": "center"}))
103
+ # hack to remove index column: https://github.com/streamlit/streamlit/issues/641
104
+ # st.table(df.assign(hack="").set_index("hack"))
 
requirements.txt CHANGED
@@ -1,3 +1,2 @@
1
- streamlit>=0.87.0
2
  pandas
3
  python-dotenv
 
1
  pandas
2
  python-dotenv