Weyaxi commited on
Commit
d2df42d
1 Parent(s): 101085b

open llm leaderboard thing fix 2 ==> delete local file

Browse files
Files changed (1) hide show
  1. openllm.py +0 -40
openllm.py DELETED
@@ -1,40 +0,0 @@
1
- import argparse
2
- import requests
3
- from bs4 import BeautifulSoup
4
- import pandas as pd
5
- import json
6
-
7
- # Repo: https://github.com/Weyaxi/scrape-open-llm-leaderboard
8
-
9
- def get_json_format_data():
10
- url = 'https://huggingfaceh4-open-llm-leaderboard.hf.space/'
11
- response = requests.get(url)
12
- soup = BeautifulSoup(response.content, 'html.parser')
13
-
14
- script_elements = soup.find_all('script')
15
- json_format_data = json.loads(str(script_elements[1])[31:-10])
16
- return json_format_data
17
-
18
-
19
- def get_datas(data):
20
- for component_index in range(10, 50, 1): # component_index sometimes changes when they update the space, we can use this "for" loop to avoid changing component index manually
21
- try:
22
- result_list = []
23
- i = 0
24
- while True:
25
- try:
26
- results = data['components'][component_index]['props']['value']['data'][i]
27
- type_of_emoji = data['components'][component_index]['props']['value']['data'][i][0]
28
-
29
- try:
30
- results_json = {"T": type_of_emoji, "Model": results[-1], "Average ⬆️": results[2], "ARC": results[3], "HellaSwag": results[4], "MMLU": results[5], "TruthfulQA": results[6], "Winogrande": results[7], "GSM8K": results[8], "DROP": results[9], "Type": results[10], "Precision": results[11], "Hub License": results[12], "#Params (B)": results[13], "Hub ❤️": results[14], "Model Sha": results[16]}
31
- except IndexError: # Wrong component index, so breaking loop to try next component index. (NOTE: More than one component index can give you some results but we must find the right component index to get all results we want.)
32
- break
33
- result_list.append(results_json)
34
- i += 1
35
- except IndexError: # No rows to extract so return the list (We know it is the right component index because we didn't break out of loop on the other exception.)
36
- return result_list
37
- except (KeyError, TypeError):
38
- continue
39
-
40
- return result_list