vtrv.vls commited on
Commit
0b24b94
Β·
1 Parent(s): 80b9350

Tabs themes

Browse files
Files changed (1) hide show
  1. app.py +23 -44
app.py CHANGED
@@ -187,59 +187,57 @@ def tab_leaderboard():
187
  # s = df.style.apply(highlight_cols, axis = None)
188
 
189
  # Displaying the styled dataframe in Gradio
190
- with gradio.TabItem("Autogen Metrics", elem_id="od-benchmark-tab-table-ablation", id=0, elem_classes="subtab"):
191
  with gradio.Blocks() as demo:
192
  gradio.DataFrame(df)
193
 
194
- with gradio.TabItem("Autometrics", elem_id="od-benchmark-tab-table-ablation", id=1, elem_classes="subtab"):
195
  with gradio.Blocks() as demo:
196
  gradio.DataFrame(df)
197
 
198
- with gradio.TabItem("SBS metrics", elem_id="od-benchmark-tab-table-ablation", id=2, elem_classes="subtab"):
199
  with gradio.Blocks() as demo:
200
  gradio.DataFrame(df)
201
 
202
- with gradio.TabItem("Arena ELO rating", elem_id="od-benchmark-tab-table-ablation", id=3, elem_classes="subtab"):
203
  with gradio.Blocks() as demo:
204
  gradio.DataFrame(df)
205
 
206
  def tab_offline_arena():
207
  global MODEL_LIST
208
- # with gradio.Row():
209
- # btn_show_history = gradio.Button("🎲 Click here to sample an example + a pair of LLM outputs! ", elem_classes="sample_button")
210
  with gradio.Row():
211
  with gradio.Column(scale=1):
212
- with gradio.Accordion("Choose models to sample from", open=False, elem_classes="accordion-label"):
213
  model_options = MODEL_LIST
214
- selected_models = gradio.CheckboxGroup(model_options, info="", value=model_options, show_label=False, elem_id="select-models", interactive=True)
215
- clear_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
216
  # clear the selected_models
217
  clear_button.click(lambda: {selected_models: {"value": [], "__type__": "update"}}, inputs=[], outputs=[selected_models])
218
  with gradio.Column(scale=1):
219
- with gradio.Accordion("Choose task types to sample from", open=False, elem_classes="accordion-label"):
220
- select_tasks = gradio.CheckboxGroup(['Task 1', "Task 2", "Task 3"], info="", value=['Task 1', "Task 2", "Task 3"], show_label=False, elem_id="select-tasks", interactive=True)
221
- clear_task_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
222
  # clear the select_tasks
223
  clear_task_button.click(lambda: {select_tasks: {"value": [], "__type__": "update"}}, inputs=[], outputs=[select_tasks])
224
  btn_show_history = gradio.Button("Click to get sample and models' ouputs")
225
  with gradio.Column(scale=1):
226
- with gradio.Accordion("Choose criteria to sample", open=False, elem_classes="accordion-label"):
227
  with gradio.Row():
228
  with gradio.Tab("Task 1"):
229
- select_criteria_1 = gradio.CheckboxGroup(['Criterion 1', "Criterion 2", "Criterion 3"], info="", value=['Criterion 1', "Criterion 2", "Criterion 3"], show_label=False, elem_id="select-criteria", interactive=True)
230
  with gradio.Tab("Task 2"):
231
- select_criteria_2 = gradio.CheckboxGroup(['Criterion 1', "Criterion 2", "Criterion 3"], info="", value=['Criterion 1', "Criterion 2", "Criterion 3"], show_label=False, elem_id="select-criteria", interactive=True)
232
  with gradio.Tab("Task 3"):
233
- select_criteria_3 = gradio.CheckboxGroup(['Criterion 1', "Criterion 2", "Criterion 3"], info="", value=['Criterion 1', "Criterion 2", "Criterion 3"], show_label=False, elem_id="select-criteria", interactive=True)
234
 
235
- clear_criteria_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
236
  # clear the select_tasks
237
  clear_criteria_button.click(lambda: {select_criteria_1: {"value": [], "__type__": "update"},
238
  select_criteria_2: {"value": [], "__type__": "update"},
239
  select_criteria_3: {"value": [], "__type__": "update"}},
240
  inputs=[], outputs=[select_criteria_1, select_criteria_2, select_criteria_3])
241
 
242
- with gradio.Accordion("History", open=True, elem_classes="accordion-label"):
243
  with gradio.Row():
244
  with gradio.Column():
245
  pass
@@ -250,44 +248,25 @@ def tab_offline_arena():
250
  with gradio.Row():
251
  model_a = gradio.Text("Indeed we are.", label='Model A')
252
  model_b = gradio.Text("Are we?", label='Model B')
253
- # with gradio.Blocks():
254
- # select_tasks.change(lambda: {select_criteria: {"value": [], "__type__": "update"}}, inputs=[], outputs=[select_criteria])
255
 
256
 
257
  def build_demo():
258
- # global original_dfs, available_models, gpt4t_dfs, haiku_dfs, llama_dfs
259
-
260
  with gradio.Blocks(theme=gradio.themes.Soft(text_size=gradio.themes.sizes.text_lg)) as demo: # , css=css, js=js_light
261
- # gradio.HTML(BANNER, elem_id="banner")
262
- # gradio.Markdown(HEADER_MD.replace("{model_num}", str(len(original_dfs["-1"]))), elem_classes="markdown-text")
263
 
264
- with gradio.Tabs(elem_classes="tab-buttons") as tabs:
265
- with gradio.TabItem("🐼 MERA leaderboard", elem_id="od-benchmark-tab-table", id=0):
266
- gradio.Markdown(TEST_MD, elem_classes="markdown-text-details")
267
  tab_leaderboard()
268
 
269
- with gradio.TabItem("πŸ†š SBS by categories and criteria", elem_id="od-benchmark-tab-table", id=1):
270
- # gradio.Markdown(TEST_MD, elem_classes="markdown-text-details")
271
  tab_offline_arena()
272
 
273
- with gradio.TabItem("πŸ₯Š Model arena", elem_id="od-benchmark-tab-table", id=2):
274
  tab_online_arena()
275
  # _tab_explore()
276
 
277
- with gradio.TabItem("πŸ’ͺ About MERA", elem_id="od-benchmark-tab-table", id=3):
278
- gradio.Markdown(TEST_MD, elem_classes="markdown-text")
279
- # gr.Markdown(f"Last updated on **{LAST_UPDATED}** | [Link to V1-legacy](https://huggingface.co/spaces/allenai/WildBench-V1-legacy)", elem_classes="markdown-text-small")
280
-
281
- # with gr.Row():
282
- # with gr.Accordion("πŸ“™ Citation", open=False, elem_classes="accordion-label"):
283
- # gr.Textbox(
284
- # value=CITATION_TEXT,
285
- # lines=7,
286
- # label="Copy the BibTeX snippet to cite this source",
287
- # elem_id="citation-button",
288
- # show_copy_button=True)
289
- # ).style(show_copy_button=True)
290
-
291
  return demo
292
 
293
  if __name__ == "__main__":
 
187
  # s = df.style.apply(highlight_cols, axis = None)
188
 
189
  # Displaying the styled dataframe in Gradio
190
+ with gradio.TabItem("Autogen Metrics", id=0):
191
  with gradio.Blocks() as demo:
192
  gradio.DataFrame(df)
193
 
194
+ with gradio.TabItem("Autometrics", id=1):
195
  with gradio.Blocks() as demo:
196
  gradio.DataFrame(df)
197
 
198
+ with gradio.TabItem("SBS metrics", id=2):
199
  with gradio.Blocks() as demo:
200
  gradio.DataFrame(df)
201
 
202
+ with gradio.TabItem("Arena ELO rating", id=3):
203
  with gradio.Blocks() as demo:
204
  gradio.DataFrame(df)
205
 
206
  def tab_offline_arena():
207
  global MODEL_LIST
 
 
208
  with gradio.Row():
209
  with gradio.Column(scale=1):
210
+ with gradio.Accordion("Choose models to sample from", open=False):
211
  model_options = MODEL_LIST
212
+ selected_models = gradio.CheckboxGroup(model_options, info="", value=model_options, show_label=False, interactive=True)
213
+ clear_button = gradio.Button("Clear", scale=1)
214
  # clear the selected_models
215
  clear_button.click(lambda: {selected_models: {"value": [], "__type__": "update"}}, inputs=[], outputs=[selected_models])
216
  with gradio.Column(scale=1):
217
+ with gradio.Accordion("Choose task types to sample from", open=False):
218
+ select_tasks = gradio.CheckboxGroup(['Task 1', "Task 2", "Task 3"], info="", value=['Task 1', "Task 2", "Task 3"], show_label=False, interactive=True)
219
+ clear_task_button = gradio.Button("Clear", scale=1)
220
  # clear the select_tasks
221
  clear_task_button.click(lambda: {select_tasks: {"value": [], "__type__": "update"}}, inputs=[], outputs=[select_tasks])
222
  btn_show_history = gradio.Button("Click to get sample and models' ouputs")
223
  with gradio.Column(scale=1):
224
+ with gradio.Accordion("Choose criteria to sample", open=False):
225
  with gradio.Row():
226
  with gradio.Tab("Task 1"):
227
+ select_criteria_1 = gradio.CheckboxGroup(['Criterion 1', "Criterion 2", "Criterion 3"], info="", value=['Criterion 1', "Criterion 2", "Criterion 3"], show_label=False, interactive=True)
228
  with gradio.Tab("Task 2"):
229
+ select_criteria_2 = gradio.CheckboxGroup(['Criterion 1', "Criterion 2", "Criterion 3"], info="", value=['Criterion 1', "Criterion 2", "Criterion 3"], show_label=False, interactive=True)
230
  with gradio.Tab("Task 3"):
231
+ select_criteria_3 = gradio.CheckboxGroup(['Criterion 1', "Criterion 2", "Criterion 3"], info="", value=['Criterion 1', "Criterion 2", "Criterion 3"], show_label=False, interactive=True)
232
 
233
+ clear_criteria_button = gradio.Button("Clear", scale=1)
234
  # clear the select_tasks
235
  clear_criteria_button.click(lambda: {select_criteria_1: {"value": [], "__type__": "update"},
236
  select_criteria_2: {"value": [], "__type__": "update"},
237
  select_criteria_3: {"value": [], "__type__": "update"}},
238
  inputs=[], outputs=[select_criteria_1, select_criteria_2, select_criteria_3])
239
 
240
+ with gradio.Accordion("History", open=True):
241
  with gradio.Row():
242
  with gradio.Column():
243
  pass
 
248
  with gradio.Row():
249
  model_a = gradio.Text("Indeed we are.", label='Model A')
250
  model_b = gradio.Text("Are we?", label='Model B')
 
 
251
 
252
 
253
  def build_demo():
 
 
254
  with gradio.Blocks(theme=gradio.themes.Soft(text_size=gradio.themes.sizes.text_lg)) as demo: # , css=css, js=js_light
 
 
255
 
256
+ with gradio.Tabs() as tabs:
257
+ with gradio.TabItem("🐼 MERA leaderboard", id=0):
258
+ gradio.Markdown(TEST_MD)
259
  tab_leaderboard()
260
 
261
+ with gradio.TabItem("πŸ†š SBS by categories and criteria", id=1):
 
262
  tab_offline_arena()
263
 
264
+ with gradio.TabItem("πŸ₯Š Model arena", id=2):
265
  tab_online_arena()
266
  # _tab_explore()
267
 
268
+ with gradio.TabItem("πŸ’ͺ About MERA", id=3):
269
+ gradio.Markdown(TEST_MD)
 
 
 
 
 
 
 
 
 
 
 
 
270
  return demo
271
 
272
  if __name__ == "__main__":