vtrv.vls commited on
Commit
de62f09
Β·
1 Parent(s): fa1a2c3

Functionality rework

Browse files
Files changed (1) hide show
  1. app.py +31 -5
app.py CHANGED
@@ -13,6 +13,7 @@ from models import get_tinyllama, get_qwen2ins1b, GigaChat, response_gigachat, r
13
 
14
  INIT_MODELS = dict()
15
  S3_SESSION = None
 
16
  CURRENT_MODELS = queue.LifoQueue()
17
  MODEL_LIB = {'TINYLLAMA': get_tinyllama, "QWEN2INS1B": get_qwen2ins1b, "RUBASE": GigaChat.get_giga}
18
  GEN_LIB = {'TINYLLAMA': response_tinyllama, "QWEN2INS1B": response_qwen2ins1b, "RUBASE": response_gigachat}
@@ -86,7 +87,7 @@ def model_manager(
86
  CURRENT_MODELS.put(add_model)
87
  INIT_MODELS[add_model] = model_lib[add_model]()
88
 
89
- def tab_arena():
90
  global S3_SESSION, GEN_LIB, MODEL_LIB, INIT_MODELS, CURRENT_MODELS
91
  with gradio.Row():
92
  with gradio.Column():
@@ -196,8 +197,29 @@ def tab_leaderboard():
196
  with gradio.Blocks() as demo:
197
  gradio.DataFrame(df)
198
 
199
- with open("test.md", "r") as f:
200
- TEST_MD = f.read()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  def build_demo():
203
  # global original_dfs, available_models, gpt4t_dfs, haiku_dfs, llama_dfs
@@ -212,10 +234,11 @@ def build_demo():
212
  tab_leaderboard()
213
 
214
  with gradio.TabItem("πŸ†š SBS by categories and criteria", elem_id="od-benchmark-tab-table", id=1):
215
- gradio.Markdown(TEST_MD, elem_classes="markdown-text-details")
 
216
 
217
  with gradio.TabItem("πŸ₯Š Model arena", elem_id="od-benchmark-tab-table", id=2):
218
- tab_arena()
219
  # _tab_explore()
220
 
221
  with gradio.TabItem("πŸ’ͺ About MERA", elem_id="od-benchmark-tab-table", id=3):
@@ -242,6 +265,9 @@ if __name__ == "__main__":
242
  # data_load(args.result_file)
243
  # TYPES = ["number", "markdown", "number"]
244
 
 
 
 
245
  try:
246
  session = boto3.session.Session()
247
  S3_SESSION = session.client(
 
13
 
14
  INIT_MODELS = dict()
15
  S3_SESSION = None
16
+ TEST_MD = None
17
  CURRENT_MODELS = queue.LifoQueue()
18
  MODEL_LIB = {'TINYLLAMA': get_tinyllama, "QWEN2INS1B": get_qwen2ins1b, "RUBASE": GigaChat.get_giga}
19
  GEN_LIB = {'TINYLLAMA': response_tinyllama, "QWEN2INS1B": response_qwen2ins1b, "RUBASE": response_gigachat}
 
87
  CURRENT_MODELS.put(add_model)
88
  INIT_MODELS[add_model] = model_lib[add_model]()
89
 
90
+ def tab_online_arena():
91
  global S3_SESSION, GEN_LIB, MODEL_LIB, INIT_MODELS, CURRENT_MODELS
92
  with gradio.Row():
93
  with gradio.Column():
 
197
  with gradio.Blocks() as demo:
198
  gradio.DataFrame(df)
199
 
200
+ def tab_offline_arena():
201
+ # with gradio.Row():
202
+ # btn_show_history = gradio.Button("🎲 Click here to sample an example + a pair of LLM outputs! ", elem_classes="sample_button")
203
+ with gradio.Row():
204
+ with gradio.Column(scale=2):
205
+ with gradio.Accordion("Choose models to sample from", open=False, elem_classes="accordion-label"):
206
+ model_options = list(MODEL_LIB.keys())
207
+ selected_models = gradio.CheckboxGroup(model_options, info="", value=model_options, show_label=False, elem_id="select-models")
208
+ clear_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
209
+ # clear the selected_models
210
+ clear_button.click(lambda: {selected_models: {"value": [], "__type__": "update"}}, inputs=[], outputs=[selected_models])
211
+ with gradio.Column(scale=1):
212
+ with gradio.Accordion("Choose task types to sample from", open=False, elem_classes="accordion-label"):
213
+ 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")
214
+ clear_task_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
215
+ # clear the select_tasks
216
+ clear_task_button.click(lambda: {select_tasks: {"value": [], "__type__": "update"}}, inputs=[], outputs=[select_tasks])
217
+ with gradio.Accordion("Choose criteria to sample from", open=False, elem_classes="accordion-label"):
218
+ select_tasks = gradio.CheckboxGroup(['Criterion 1', "Criterion 2", "Criterion 3"], info="", value=['Criterion 1', "Criterion 2", "Criterion 3"], show_label=False, elem_id="select-criteria")
219
+ clear_task_button = gradio.Button("Clear", elem_classes="btn_boderline_gray", scale=1)
220
+ # clear the select_tasks
221
+ clear_task_button.click(lambda: {select_tasks: {"value": [], "__type__": "update"}}, inputs=[], outputs=[select_tasks])
222
+
223
 
224
  def build_demo():
225
  # global original_dfs, available_models, gpt4t_dfs, haiku_dfs, llama_dfs
 
234
  tab_leaderboard()
235
 
236
  with gradio.TabItem("πŸ†š SBS by categories and criteria", elem_id="od-benchmark-tab-table", id=1):
237
+ # gradio.Markdown(TEST_MD, elem_classes="markdown-text-details")
238
+ tab_offline_arena()
239
 
240
  with gradio.TabItem("πŸ₯Š Model arena", elem_id="od-benchmark-tab-table", id=2):
241
+ tab_online_arena()
242
  # _tab_explore()
243
 
244
  with gradio.TabItem("πŸ’ͺ About MERA", elem_id="od-benchmark-tab-table", id=3):
 
265
  # data_load(args.result_file)
266
  # TYPES = ["number", "markdown", "number"]
267
 
268
+ with open("test.md", "r") as f:
269
+ TEST_MD = f.read()
270
+
271
  try:
272
  session = boto3.session.Session()
273
  S3_SESSION = session.client(