KennyUTC commited on
Commit
3ca1aed
·
1 Parent(s): 285de44

add model_name box

Browse files
Files changed (1) hide show
  1. app.py +38 -4
app.py CHANGED
@@ -49,6 +49,11 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
49
 
50
  headers = ['Rank'] + check_box['essential'] + checkbox_group.value
51
  with gr.Row():
 
 
 
 
 
52
  model_size = gr.CheckboxGroup(
53
  choices=MODEL_SIZE,
54
  value=MODEL_SIZE,
@@ -61,6 +66,7 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
61
  label='Model Type',
62
  interactive=True
63
  )
 
64
  data_component = gr.components.DataFrame(
65
  value=table[headers],
66
  type='pandas',
@@ -68,7 +74,7 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
68
  interactive=False,
69
  visible=True)
70
 
71
- def filter_df(fields, model_size, model_type):
72
  results = load_results()['results']
73
  headers = ['Rank'] + check_box['essential'] + fields
74
 
@@ -82,6 +88,15 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
82
  df = df[df['flag']]
83
  df.pop('flag')
84
  df['Rank'] = list(range(1, len(df) + 1))
 
 
 
 
 
 
 
 
 
85
 
86
  comp = gr.components.DataFrame(
87
  value=df[headers],
@@ -92,7 +107,8 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
92
  return comp
93
 
94
  for cbox in [checkbox_group, model_size, model_type]:
95
- cbox.change(fn=filter_df, inputs=[checkbox_group, model_size, model_type], outputs=data_component)
 
96
 
97
  for i, dataset in enumerate(DATASETS):
98
  tab_name_map = {
@@ -118,6 +134,11 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
118
  s.table['Rank'] = list(range(1, len(s.table) + 1))
119
 
120
  with gr.Row():
 
 
 
 
 
121
  s.model_size = gr.CheckboxGroup(
122
  choices=MODEL_SIZE,
123
  value=MODEL_SIZE,
@@ -138,7 +159,7 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
138
  visible=True)
139
  s.dataset = gr.Textbox(value=dataset, label=dataset, visible=False)
140
 
141
- def filter_df_l2(dataset_name, fields, model_size, model_type):
142
  results = load_results()['results']
143
  s = structs[DATASETS.index(dataset_name)]
144
  headers = ['Rank'] + s.check_box['essential'] + fields
@@ -151,6 +172,15 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
151
  df = df[df['flag']]
152
  df.pop('flag')
153
  df['Rank'] = list(range(1, len(df) + 1))
 
 
 
 
 
 
 
 
 
154
 
155
  comp = gr.components.DataFrame(
156
  value=df[headers],
@@ -163,8 +193,12 @@ with gr.Blocks(title="Math Leaderboard", head=head_style) as demo:
163
  for cbox in [s.checkbox_group, s.model_size, s.model_type]:
164
  cbox.change(
165
  fn=filter_df_l2,
166
- inputs=[s.dataset, s.checkbox_group, s.model_size, s.model_type],
167
  outputs=s.data_component)
 
 
 
 
168
 
169
  with gr.Row():
170
  with gr.Accordion('Citation', open=False):
 
49
 
50
  headers = ['Rank'] + check_box['essential'] + checkbox_group.value
51
  with gr.Row():
52
+ model_name = gr.Textbox(
53
+ value='Input the Model Name (fuzzy)',
54
+ label='Model Name',
55
+ interactive=True,
56
+ visible=True)
57
  model_size = gr.CheckboxGroup(
58
  choices=MODEL_SIZE,
59
  value=MODEL_SIZE,
 
66
  label='Model Type',
67
  interactive=True
68
  )
69
+
70
  data_component = gr.components.DataFrame(
71
  value=table[headers],
72
  type='pandas',
 
74
  interactive=False,
75
  visible=True)
76
 
77
+ def filter_df(fields, model_name, model_size, model_type):
78
  results = load_results()['results']
79
  headers = ['Rank'] + check_box['essential'] + fields
80
 
 
88
  df = df[df['flag']]
89
  df.pop('flag')
90
  df['Rank'] = list(range(1, len(df) + 1))
91
+ default_val = 'Input the Model Name (fuzzy)'
92
+ if model_name != default_val:
93
+ print(model_name)
94
+ model_name = model_name.lower()
95
+ method_names = [x.split('</a>')[0].split('>')[-1].lower() for x in df['Method']]
96
+ flag = [model_name in name for name in method_names]
97
+ df['TEMP_FLAG'] = flag
98
+ df = df[df['TEMP_FLAG'] == True]
99
+ df.pop('TEMP_FLAG')
100
 
101
  comp = gr.components.DataFrame(
102
  value=df[headers],
 
107
  return comp
108
 
109
  for cbox in [checkbox_group, model_size, model_type]:
110
+ cbox.change(fn=filter_df, inputs=[checkbox_group, model_name, model_size, model_type], outputs=data_component)
111
+ model_name.submit(fn=filter_df, inputs=[checkbox_group, model_name, model_size, model_type], outputs=data_component)
112
 
113
  for i, dataset in enumerate(DATASETS):
114
  tab_name_map = {
 
134
  s.table['Rank'] = list(range(1, len(s.table) + 1))
135
 
136
  with gr.Row():
137
+ s.model_name = gr.Textbox(
138
+ value='Input the Model Name (fuzzy)',
139
+ label='Model Name',
140
+ interactive=True,
141
+ visible=True)
142
  s.model_size = gr.CheckboxGroup(
143
  choices=MODEL_SIZE,
144
  value=MODEL_SIZE,
 
159
  visible=True)
160
  s.dataset = gr.Textbox(value=dataset, label=dataset, visible=False)
161
 
162
+ def filter_df_l2(dataset_name, fields, model_name, model_size, model_type):
163
  results = load_results()['results']
164
  s = structs[DATASETS.index(dataset_name)]
165
  headers = ['Rank'] + s.check_box['essential'] + fields
 
172
  df = df[df['flag']]
173
  df.pop('flag')
174
  df['Rank'] = list(range(1, len(df) + 1))
175
+ default_val = 'Input the Model Name (fuzzy)'
176
+ if model_name != default_val:
177
+ print(model_name)
178
+ model_name = model_name.lower()
179
+ method_names = [x.split('</a>')[0].split('>')[-1].lower() for x in df['Method']]
180
+ flag = [model_name in name for name in method_names]
181
+ df['TEMP_FLAG'] = flag
182
+ df = df[df['TEMP_FLAG'] == True]
183
+ df.pop('TEMP_FLAG')
184
 
185
  comp = gr.components.DataFrame(
186
  value=df[headers],
 
193
  for cbox in [s.checkbox_group, s.model_size, s.model_type]:
194
  cbox.change(
195
  fn=filter_df_l2,
196
+ inputs=[s.dataset, s.checkbox_group, s.model_name, s.model_size, s.model_type],
197
  outputs=s.data_component)
198
+ s.model_name.submit(
199
+ fn=filter_df_l2,
200
+ inputs=[s.dataset, s.checkbox_group, s.model_name, s.model_size, s.model_type],
201
+ outputs=s.data_component)
202
 
203
  with gr.Row():
204
  with gr.Accordion('Citation', open=False):