DontPlanToEnd commited on
Commit
fb27588
β€’
1 Parent(s): f19c73b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -49
app.py CHANGED
@@ -60,32 +60,24 @@ with demo:
60
  gr.Markdown("## UGI Leaderboard", elem_classes="text-lg text-center")
61
  gr.Markdown("""
62
  UGI: Uncensored General Intelligence. The average of 5 different subjects that LLMs are commonly steered away from. The leaderboard is made from roughly 60 questions overall, measuring both "willingness to answer" and "accuracy" in fact-based controversial questions.
63
-
64
  Willingness: A more narrow score, solely measuring the LLM's willingness to answer controversial questions.
65
-
66
  Unruly: Knowledge of activities that are generally frowned upon.
67
-
68
  Internet: Knowledge of various internet information, from professional to deviant.
69
-
70
  CrimeStats: Knowledge of crime statistics which are uncomfortable to talk about.
71
-
72
  Stories/Jokes: Ability to write offensive stories and jokes.
73
-
74
  PolContro: Knowledge of politically/socially controversial information.
75
  """)
76
  with gr.Column():
77
  with gr.Row():
78
  search_bar = gr.Textbox(placeholder=" πŸ” Search for a model...", show_label=False)
79
- with gr.Row(variant="compact"):
80
- gr.Markdown("Model sizes (in billions of parameters)", elem_classes="text-sm")
81
- param_range_1 = gr.Checkbox(label="~1.5", value=False)
82
- param_range_2 = gr.Checkbox(label="~3", value=False)
83
- param_range_3 = gr.Checkbox(label="~7", value=False)
84
- param_range_4 = gr.Checkbox(label="~13", value=False)
85
- param_range_5 = gr.Checkbox(label="~20", value=False)
86
- param_range_6 = gr.Checkbox(label="~34", value=False)
87
- param_range_7 = gr.Checkbox(label="~50", value=False)
88
- param_range_8 = gr.Checkbox(label="~70+", value=False)
89
 
90
  # Load the initial leaderboard data
91
  leaderboard_df = load_leaderboard_data("ugi-leaderboard-data.csv")
@@ -104,48 +96,22 @@ with demo:
104
  # Define the search and filter functionality
105
  inputs = [
106
  search_bar,
107
- param_range_1,
108
- param_range_2,
109
- param_range_3,
110
- param_range_4,
111
- param_range_5,
112
- param_range_6,
113
- param_range_7,
114
- param_range_8
115
  ]
116
 
117
  outputs = leaderboard_table
118
 
119
  search_bar.change(
120
- fn=lambda query, r1, r2, r3, r4, r5, r6, r7, r8: update_table(leaderboard_df, query, {
121
- '~1.5': r1,
122
- '~3': r2,
123
- '~7': r3,
124
- '~13': r4,
125
- '~20': r5,
126
- '~34': r6,
127
- '~50': r7,
128
- '~70+': r8
129
- }),
130
  inputs=inputs,
131
  outputs=outputs
132
  )
133
 
134
- for param_range in inputs[1:]:
135
- param_range.change(
136
- fn=lambda query, r1, r2, r3, r4, r5, r6, r7, r8: update_table(leaderboard_df, query, {
137
- '~1.5': r1,
138
- '~3': r2,
139
- '~7': r3,
140
- '~13': r4,
141
- '~20': r5,
142
- '~34': r6,
143
- '~50': r7,
144
- '~70+': r8
145
- }),
146
- inputs=inputs,
147
- outputs=outputs
148
- )
149
 
150
  # Launch the Gradio app
151
  demo.launch()
 
60
  gr.Markdown("## UGI Leaderboard", elem_classes="text-lg text-center")
61
  gr.Markdown("""
62
  UGI: Uncensored General Intelligence. The average of 5 different subjects that LLMs are commonly steered away from. The leaderboard is made from roughly 60 questions overall, measuring both "willingness to answer" and "accuracy" in fact-based controversial questions.
 
63
  Willingness: A more narrow score, solely measuring the LLM's willingness to answer controversial questions.
 
64
  Unruly: Knowledge of activities that are generally frowned upon.
 
65
  Internet: Knowledge of various internet information, from professional to deviant.
 
66
  CrimeStats: Knowledge of crime statistics which are uncomfortable to talk about.
 
67
  Stories/Jokes: Ability to write offensive stories and jokes.
 
68
  PolContro: Knowledge of politically/socially controversial information.
69
  """)
70
  with gr.Column():
71
  with gr.Row():
72
  search_bar = gr.Textbox(placeholder=" πŸ” Search for a model...", show_label=False)
73
+ with gr.Row():
74
+ filter_columns_size = gr.CheckboxGroup(
75
+ label="Model sizes (in billions of parameters)",
76
+ choices=['~1.5', '~3', '~7', '~13', '~20', '~34', '~50', '~70+'],
77
+ value=['~1.5', '~3', '~7', '~13', '~20', '~34', '~50', '~70+'],
78
+ interactive=True,
79
+ elem_id="filter-columns-size",
80
+ )
 
 
81
 
82
  # Load the initial leaderboard data
83
  leaderboard_df = load_leaderboard_data("ugi-leaderboard-data.csv")
 
96
  # Define the search and filter functionality
97
  inputs = [
98
  search_bar,
99
+ filter_columns_size
 
 
 
 
 
 
 
100
  ]
101
 
102
  outputs = leaderboard_table
103
 
104
  search_bar.change(
105
+ fn=lambda query, param_ranges: update_table(leaderboard_df, query, dict(zip(['~1.5', '~3', '~7', '~13', '~20', '~34', '~50', '~70+'], param_ranges))),
 
 
 
 
 
 
 
 
 
106
  inputs=inputs,
107
  outputs=outputs
108
  )
109
 
110
+ filter_columns_size.change(
111
+ fn=lambda query, param_ranges: update_table(leaderboard_df, query, dict(zip(['~1.5', '~3', '~7', '~13', '~20', '~34', '~50', '~70+'], param_ranges))),
112
+ inputs=inputs,
113
+ outputs=outputs
114
+ )
 
 
 
 
 
 
 
 
 
 
115
 
116
  # Launch the Gradio app
117
  demo.launch()