liorgreenb commited on
Commit
ccecac4
·
1 Parent(s): ba1ec42

Fix more tasks tables

Browse files
Files changed (1) hide show
  1. app.py +15 -13
app.py CHANGED
@@ -12,7 +12,7 @@ hf_api = HfApi()
12
 
13
  models = list(hf_api.list_models(filter=benchmark_tag))
14
 
15
- supported_tasks = [
16
  'in_catalog_retrieval_zero_shot',
17
  'in_catalog_open_catalog',
18
  'in_catalog_closed_catalog',
@@ -41,7 +41,7 @@ def get_model_results(model_meta):
41
  metrics_meta = []
42
  for index in model_meta['model-index']:
43
  for result in index['results']:
44
- if result['dataset']['type'].split('/')[0] == benchmark_user and result['dataset']['config'] in supported_tasks:
45
  metrics_dict = {metric['name']: metric['value'] for metric in result['metrics']}
46
  metrics_meta += [dict(dataset=result['dataset']['type'], task=result['dataset']['config'], **metrics_dict)]
47
 
@@ -70,17 +70,19 @@ print(df)
70
  block = gr.Blocks()
71
 
72
  with block:
73
- for group_name, group in df.groupby('task'):
74
- gr.Markdown(f"## Task - {group_name}")
75
-
76
- group = group.sort_values('ROC_AUC', ascending=False)
77
- group['dataset'] = group['dataset'].apply(lambda x: create_model_link(x, type="datasets"))
78
- gr.DataFrame(
79
- group.reset_index(drop=True),
80
- datatype=['markdown', 'markdown'] + ['number'] * len(group.columns),
81
- wrap=True,
82
- )
83
-
 
 
84
 
85
  block.launch()
86
 
 
12
 
13
  models = list(hf_api.list_models(filter=benchmark_tag))
14
 
15
+ SUPPORTED_TASKS = [
16
  'in_catalog_retrieval_zero_shot',
17
  'in_catalog_open_catalog',
18
  'in_catalog_closed_catalog',
 
41
  metrics_meta = []
42
  for index in model_meta['model-index']:
43
  for result in index['results']:
44
+ if result['dataset']['type'].split('/')[0] == benchmark_user and result['dataset']['config'] in SUPPORTED_TASKS:
45
  metrics_dict = {metric['name']: metric['value'] for metric in result['metrics']}
46
  metrics_meta += [dict(dataset=result['dataset']['type'], task=result['dataset']['config'], **metrics_dict)]
47
 
 
70
  block = gr.Blocks()
71
 
72
  with block:
73
+ for task in SUPPORTED_TASKS:
74
+ group = df[df['task'] == task]
75
+
76
+ if len(group) > 0:
77
+ gr.Markdown(f"## Task - {task}")
78
+
79
+ group = group.sort_values('ROC_AUC', ascending=False)
80
+ group['dataset'] = group['dataset'].apply(lambda x: create_model_link(x, type="datasets"))
81
+ gr.DataFrame(
82
+ group.reset_index(drop=True),
83
+ datatype=['markdown', 'markdown'] + ['number'] * len(group.columns),
84
+ wrap=True,
85
+ )
86
 
87
  block.launch()
88