|
|
|
import argparse |
|
import requests |
|
from bs4 import BeautifulSoup |
|
import pandas as pd |
|
import json |
|
|
|
|
|
|
|
def get_json_format_data(): |
|
url = 'https://huggingfaceh4-open-llm-leaderboard.hf.space/' |
|
response = requests.get(url) |
|
soup = BeautifulSoup(response.content, 'html.parser') |
|
|
|
script_elements = soup.find_all('script') |
|
json_format_data = json.loads(str(script_elements[1])[31:-10]) |
|
return json_format_data |
|
|
|
|
|
def get_datas(data): |
|
for component_index in range(10, 50, 1): |
|
try: |
|
result_list = [] |
|
i = 0 |
|
while True: |
|
try: |
|
results = data['components'][component_index]['props']['value']['data'][i] |
|
type_of_emoji = data['components'][component_index]['props']['value']['data'][i][0] |
|
|
|
try: |
|
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]} |
|
except IndexError: |
|
break |
|
result_list.append(results_json) |
|
i += 1 |
|
except IndexError: |
|
return result_list |
|
except (KeyError, TypeError): |
|
continue |
|
|
|
return result_list |
|
|