Amit Kumar commited on
Commit
888c965
Β·
1 Parent(s): c44f168

changed formatting

Browse files
Files changed (2) hide show
  1. about/description.md +2 -2
  2. app.py +35 -36
about/description.md CHANGED
@@ -10,8 +10,8 @@ The leaderboard offers a comprehensive assessment of each model's classification
10
 
11
  <h2 style="color: #00ff00;">Evaluation Criteria:</h2>
12
  The primary metric used for evaluation is accuracy, which measures the proportion of correct predictions made by the model. We used two levels of accruacy <br>
13
- 1. <b> Label-level accuracy <b>: Accuracy is measured in terms of total labels.<br>
14
- 2. <b> Record-level accuracy <b>: Accuracy is measured if a report is classified accurately across all labels.
15
 
16
  <h2 style="color: #00ff00;">Different Parameters:</h2> The leaderboard displays the different type of settings explored to get various results <br>
17
  1. <b> Different shots prompting </b>: 0 shot, 1 shot, 5 shots. <br>
 
10
 
11
  <h2 style="color: #00ff00;">Evaluation Criteria:</h2>
12
  The primary metric used for evaluation is accuracy, which measures the proportion of correct predictions made by the model. We used two levels of accruacy <br>
13
+ 1. <b> Label-level accuracy </b>: Accuracy is measured in terms of total labels.<br>
14
+ 2. <b> Record-level accuracy </b>: Accuracy is measured if a report is classified accurately across all labels.
15
 
16
  <h2 style="color: #00ff00;">Different Parameters:</h2> The leaderboard displays the different type of settings explored to get various results <br>
17
  1. <b> Different shots prompting </b>: 0 shot, 1 shot, 5 shots. <br>
app.py CHANGED
@@ -15,6 +15,41 @@ with open(DESCRIPTION_FILE, "r") as f:
15
  html_description = markdown.markdown(md_text, extensions=["tables"])
16
  columns_fixed = ["Model Name", "Average Label", "Average Record"]
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  with gr.Blocks() as demo:
19
  gr.Markdown("<h1 style='text-align: center;'>πŸ† Medical Classification Leaderboard - Beta</h1>")
20
  gr.Image("./about/linguist.png", elem_id="linguist-image", show_label=False)
@@ -31,41 +66,6 @@ with gr.Blocks() as demo:
31
 
32
  gr.HTML(html_description)
33
 
34
- df = load_leaderboard()
35
- all_columns = list(df.columns)
36
- columns_variable = [i for i in all_columns if i not in columns_fixed]
37
-
38
- shot_options = ["0 shot", "1 shot", "5 shots"]
39
-
40
-
41
- def get_columns_for_shots(selected_shots):
42
- if not selected_shots:
43
- return []
44
- return [col for col in all_columns if any(shot in col for shot in selected_shots)]
45
-
46
- def get_columns_for_data(selected_data):
47
- if not selected_data:
48
- return []
49
- return [col for col in all_columns if any(data in col for data in selected_data)]
50
-
51
- # data_types = sorted(df["data_type"].dropna().unique())
52
- parameter_options = sorted(df["Parameters"].dropna().unique())
53
-
54
- def filter_leaderboard(selected_params, selected_shots, selected_data):
55
- filtered = df.copy()
56
- print("Selected Shots:", selected_shots)
57
- if selected_params:
58
- filtered = filtered[filtered["Parameters"].isin(selected_params)]
59
-
60
- columns_by_shot = get_columns_for_shots(selected_shots)
61
- columns_by_data = get_columns_for_data(selected_data)
62
- additional_columns = [col for col in columns_by_shot + columns_by_data if col in df.columns]
63
- cols_to_show = list(dict.fromkeys(columns_fixed + additional_columns))
64
-
65
- print("COLUMNS TO SHOW:", cols_to_show)
66
-
67
- return filtered[cols_to_show]
68
-
69
 
70
  with gr.Row():
71
  # dataset_filter = gr.Dropdown(label="πŸ“‚ Select Benchmark Dataset", choices=dataset_options, value="All")
@@ -99,6 +99,5 @@ with gr.Blocks() as demo:
99
  shot_filter.change(fn=filter_leaderboard, inputs=[param_filter, shot_filter, column_selector_data,], outputs=leaderboard_table)
100
 
101
  # leaderboard_table.value = filter_leaderboard(parameter_options, shot_options, ["Chexpert Plus", "CT Rate"])
102
- print(leaderboard_table.value)
103
 
104
  demo.launch()
 
15
  html_description = markdown.markdown(md_text, extensions=["tables"])
16
  columns_fixed = ["Model Name", "Average Label", "Average Record"]
17
 
18
+ df = load_leaderboard()
19
+ all_columns = list(df.columns)
20
+ columns_variable = [i for i in all_columns if i not in columns_fixed]
21
+
22
+ shot_options = ["0 shot", "1 shot", "5 shots"]
23
+
24
+
25
+ def get_columns_for_shots(selected_shots):
26
+ if not selected_shots:
27
+ return []
28
+ return [col for col in all_columns if any(shot in col for shot in selected_shots)]
29
+
30
+ def get_columns_for_data(selected_data):
31
+ if not selected_data:
32
+ return []
33
+ return [col for col in all_columns if any(data in col for data in selected_data)]
34
+
35
+ # data_types = sorted(df["data_type"].dropna().unique())
36
+ parameter_options = sorted(df["Parameters"].dropna().unique())
37
+
38
+ def filter_leaderboard(selected_params, selected_shots, selected_data):
39
+ filtered = df.copy()
40
+ print("Selected Shots:", selected_shots)
41
+ if selected_params:
42
+ filtered = filtered[filtered["Parameters"].isin(selected_params)]
43
+
44
+ columns_by_shot = get_columns_for_shots(selected_shots)
45
+ columns_by_data = get_columns_for_data(selected_data)
46
+ additional_columns = [col for col in columns_by_shot + columns_by_data if col in df.columns]
47
+ cols_to_show = list(dict.fromkeys(columns_fixed + additional_columns))
48
+
49
+ print("COLUMNS TO SHOW:", cols_to_show)
50
+
51
+ return filtered[cols_to_show]
52
+
53
  with gr.Blocks() as demo:
54
  gr.Markdown("<h1 style='text-align: center;'>πŸ† Medical Classification Leaderboard - Beta</h1>")
55
  gr.Image("./about/linguist.png", elem_id="linguist-image", show_label=False)
 
66
 
67
  gr.HTML(html_description)
68
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
 
70
  with gr.Row():
71
  # dataset_filter = gr.Dropdown(label="πŸ“‚ Select Benchmark Dataset", choices=dataset_options, value="All")
 
99
  shot_filter.change(fn=filter_leaderboard, inputs=[param_filter, shot_filter, column_selector_data,], outputs=leaderboard_table)
100
 
101
  # leaderboard_table.value = filter_leaderboard(parameter_options, shot_options, ["Chexpert Plus", "CT Rate"])
 
102
 
103
  demo.launch()