myhs commited on
Commit
5b095ea
·
verified ·
1 Parent(s): 02aca53

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -6
app.py CHANGED
@@ -14,6 +14,19 @@ CITATION_BUTTON_TEXT = r"""@misc{2023opencompass,
14
  }"""
15
  CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  DATA_URL_BASE = "http://opencompass.oss-cn-shanghai.aliyuncs.com/dev-assets/hf-research/"
18
 
19
  def findfile():
@@ -35,27 +48,54 @@ MAIN_LEADERBOARD_DESCRIPTION = """## Compass Academic Leaderboard
35
  --WIP--
36
 
37
  """
38
-
39
  Initial_title = 'Compass Academic Leaderboard'
40
 
41
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  def create_interface():
43
  model_info, results = findfile()
44
 
45
  with gr.Blocks() as demo:
46
- title_comp = gr.Markdown(Initial_title)
47
  gr.Markdown(MAIN_LEADERBOARD_DESCRIPTION)
48
  with gr.Tabs(elem_classes='tab-buttons') as tabs:
49
  with gr.TabItem('Results', elem_id='main', id=0):
50
- # math_main_tab(results)
51
- pass
52
- with gr.TabItem('Predictions', elem_id='notmain', id=1):
 
53
  # dataset_tab(results, structs[i], dataset)
54
  pass
55
 
56
  return demo
57
 
58
-
59
  # model_info, results = findfile()
60
  # breakpoint()
61
 
 
14
  }"""
15
  CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results"
16
 
17
+
18
+ head_style = """
19
+ <style>
20
+ @media (min-width: 1536px)
21
+ {
22
+ .gradio-container {
23
+ min-width: var(--size-full) !important;
24
+ }
25
+ }
26
+ </style>
27
+ """
28
+
29
+
30
  DATA_URL_BASE = "http://opencompass.oss-cn-shanghai.aliyuncs.com/dev-assets/hf-research/"
31
 
32
  def findfile():
 
48
  --WIP--
49
 
50
  """
 
51
  Initial_title = 'Compass Academic Leaderboard'
52
 
53
 
54
+
55
+ def make_results_tab(model_info, results):
56
+ models_list, datasets_list = [], []
57
+ for i in model_info:
58
+ models_list.append([i['abbr'], i['display_name']])
59
+ for i in results.keys():
60
+ datasets_list.append(i)
61
+
62
+ result_list = []
63
+ index = 0
64
+ for model in models_list:
65
+ this_result = {}
66
+ this_result['Index'] = index
67
+ this_result['Model Name'] = model[1]
68
+ index += 1
69
+ for dataset in datasets_list:
70
+ this_result[dataset] = results[dataset][model[0]]
71
+ result_list.append(this_result)
72
+
73
+ df = pd.DataFrame(result_list)
74
+ return df
75
+
76
+
77
+ def show_results_tab(df):
78
+ with gr.Row():
79
+ model_name = gr.Textbox(value='Input the Model Name (fuzzy)', label='Model Name')
80
+
81
+
82
  def create_interface():
83
  model_info, results = findfile()
84
 
85
  with gr.Blocks() as demo:
86
+ # title_comp = gr.Markdown(Initial_title)
87
  gr.Markdown(MAIN_LEADERBOARD_DESCRIPTION)
88
  with gr.Tabs(elem_classes='tab-buttons') as tabs:
89
  with gr.TabItem('Results', elem_id='main', id=0):
90
+ df = make_results_tab(model_info, results)
91
+ show_results_tab(df)
92
+
93
+ with gr.TabItem('Predictions', elem_id='notmain', id=0):
94
  # dataset_tab(results, structs[i], dataset)
95
  pass
96
 
97
  return demo
98
 
 
99
  # model_info, results = findfile()
100
  # breakpoint()
101