joffrey Thomas commited on
Commit
33e4196
·
verified ·
1 Parent(s): 403650d

Leaderboard

Browse files
Files changed (1) hide show
  1. yall.py +47 -65
yall.py CHANGED
@@ -1,5 +1,4 @@
1
  import os
2
- import gistyc
3
  import requests
4
  from dataclasses import dataclass
5
  import re
@@ -19,7 +18,6 @@ class GistInfo:
19
  bigbench: float
20
  average: float
21
 
22
-
23
  def update_gist(content, gist_id, access_token):
24
  """
25
  Update the content of a GitHub Gist.
@@ -50,67 +48,51 @@ def update_gist(content, gist_id, access_token):
50
  print("Failed to update gist. Status code:", response.status_code)
51
  print("Response:", response.json())
52
 
53
-
54
- @st.cache_data
55
  def create_yall():
56
- # Get token
57
- GITHUB_API_TOKEN = os.environ.get("github")
58
-
59
- # Retrieve all gists
60
- gist_api = gistyc.GISTyc(auth_token=GITHUB_API_TOKEN)
61
- data = gist_api.get_gists()
62
-
63
- # List to store the GistInfo objects
64
- gist_infos = []
65
-
66
- for data_dict in data:
67
- if 'files' in data_dict and data_dict['files']:
68
- file_info = next(iter(data_dict['files'].values()))
69
- filename = file_info['filename']
70
- if filename.endswith("-Nous.md"):
71
- raw_url = file_info['raw_url']
72
- response = requests.get(raw_url)
73
- if response.status_code == 200:
74
- if "Error: File does not exist" not in response.text:
75
- # Parse the markdown table
76
- lines = response.text.split('\n')
77
- if len(lines) >= 3:
78
- values = lines[2].split('|')[1:-1]
79
-
80
- # Extract model name and model id using regular expression
81
- model_match = re.search(r'\[([^\]]+)\]\(https://huggingface.co/([^/]+)/([^)]+)\)', values[0].strip())
82
- if model_match:
83
- model_name = model_match.group(1)
84
- model_id = f"{model_match.group(2)}/{model_match.group(3)}"
85
- print(values[0].strip())
86
- print(model_name)
87
- print(model_id)
88
- print("=============")
89
- else:
90
- model_name = model_id = 'Unknown'
91
-
92
-
93
- # Parse the markdown table
94
- lines = response.text.split('\n')
95
- if len(lines) >= 3:
96
- values = lines[2].split('|')[1:-1]
97
-
98
- # Create a GistInfo object and add it to the list
99
- gist_info = GistInfo(
100
- gist_id=data_dict['id'],
101
- filename=filename,
102
- url=data_dict['html_url'], # Assuming html_url is the URL of the gist
103
- model_name=model_name,
104
- model_id=model_id,
105
- model=values[0].strip(),
106
- agieval=float(values[1].strip()),
107
- gpt4all=float(values[2].strip()),
108
- truthfulqa=float(values[3].strip()),
109
- bigbench=float(values[4].strip()),
110
- average=float(values[5].strip()),
111
- )
112
- gist_infos.append(gist_info)
113
-
114
  # Sort the list by average
115
  gist_infos = sorted(gist_infos, key=lambda x: x.average, reverse=True)
116
 
@@ -122,7 +104,7 @@ def create_yall():
122
  model_link = f"[{gist.model_id}](https://huggingface.co/{gist.model_id})"
123
  markdown_table += f"| {model_link} [📄]({gist.url}) | {gist.average} | {gist.agieval} | {gist.gpt4all} | {gist.truthfulqa} | {gist.bigbench} |\n"
124
 
125
- # Update YALL's gist
126
- update_gist(content=markdown_table, gist_id="90294929a2dbcb8877f9696f28105fdf", access_token=GITHUB_API_TOKEN)
127
 
128
- return markdown_table
 
1
  import os
 
2
  import requests
3
  from dataclasses import dataclass
4
  import re
 
18
  bigbench: float
19
  average: float
20
 
 
21
  def update_gist(content, gist_id, access_token):
22
  """
23
  Update the content of a GitHub Gist.
 
48
  print("Failed to update gist. Status code:", response.status_code)
49
  print("Response:", response.json())
50
 
51
+ @st.cache_data
 
52
  def create_yall():
53
+ # Dummy data
54
+ gist_infos = [
55
+ GistInfo(
56
+ gist_id="dummy_gist_id_1",
57
+ filename="Model-1.md",
58
+ url="https://gist.github.com/dummy_gist_id_1",
59
+ model_name="Model 1",
60
+ model_id="model-1",
61
+ model="Model 1",
62
+ agieval=95.4,
63
+ gpt4all=88.7,
64
+ truthfulqa=90.3,
65
+ bigbench=85.6,
66
+ average=90.0
67
+ ),
68
+ GistInfo(
69
+ gist_id="dummy_gist_id_2",
70
+ filename="Model-2.md",
71
+ url="https://gist.github.com/dummy_gist_id_2",
72
+ model_name="Model 2",
73
+ model_id="model-2",
74
+ model="Model 2",
75
+ agieval=89.1,
76
+ gpt4all=85.0,
77
+ truthfulqa=87.5,
78
+ bigbench=83.0,
79
+ average=86.2
80
+ ),
81
+ GistInfo(
82
+ gist_id="dummy_gist_id_3",
83
+ filename="Model-3.md",
84
+ url="https://gist.github.com/dummy_gist_id_3",
85
+ model_name="Model 3",
86
+ model_id="model-3",
87
+ model="Model 3",
88
+ agieval=78.2,
89
+ gpt4all=81.4,
90
+ truthfulqa=79.5,
91
+ bigbench=77.0,
92
+ average=79.0
93
+ )
94
+ ]
95
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  # Sort the list by average
97
  gist_infos = sorted(gist_infos, key=lambda x: x.average, reverse=True)
98
 
 
104
  model_link = f"[{gist.model_id}](https://huggingface.co/{gist.model_id})"
105
  markdown_table += f"| {model_link} [📄]({gist.url}) | {gist.average} | {gist.agieval} | {gist.gpt4all} | {gist.truthfulqa} | {gist.bigbench} |\n"
106
 
107
+ # Update YALL's gist with dummy gist ID and token
108
+ update_gist(content=markdown_table, gist_id="dummy_gist_id_yall", access_token="dummy_access_token")
109
 
110
+ return markdown_table