Weyaxi commited on
Commit
c61b29a
·
1 Parent(s): 54f6356

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -21
app.py CHANGED
@@ -8,6 +8,7 @@ from huggingface_hub import HfApi, list_models, list_datasets, list_spaces
8
  import gradio as gr
9
  from apscheduler.schedulers.background import BackgroundScheduler
10
  import datetime
 
11
 
12
 
13
  api = HfApi()
@@ -29,27 +30,10 @@ def get_sum(df_for_sum_function):
29
  return {"Downloads": sum_downloads, "Likes": sum_likes}
30
 
31
  def get_openllm_leaderboard():
32
- try:
33
- url = 'https://huggingfaceh4-open-llm-leaderboard.hf.space/'
34
- response = requests.get(url)
35
- soup = BeautifulSoup(response.content, 'html.parser')
36
- script_elements = soup.find_all('script')
37
- data = json.loads(str(script_elements[1])[31:-10])
38
-
39
- component_index = 19
40
-
41
- result_list = []
42
- i = 0
43
- while True:
44
- try:
45
- normal_name = data['components'][component_index]['props']['value']['data'][i][-1]
46
- result_list.append(normal_name)
47
- i += 1
48
- except (IndexError, AttributeError):
49
- return result_list
50
- except Exception as e:
51
- print("Error on open llm leaderboard: ", e)
52
- return []
53
 
54
 
55
  def get_ranking(model_list, target_org):
 
8
  import gradio as gr
9
  from apscheduler.schedulers.background import BackgroundScheduler
10
  import datetime
11
+ from openllm import *
12
 
13
 
14
  api = HfApi()
 
30
  return {"Downloads": sum_downloads, "Likes": sum_likes}
31
 
32
  def get_openllm_leaderboard():
33
+ data = get_json_format_data()
34
+ finished_models = get_datas(data)
35
+ df = pd.DataFrame(finished_models)
36
+ return df['Model'].tolist()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
 
39
  def get_ranking(model_list, target_org):