philippds commited on
Commit
dae9add
·
verified ·
1 Parent(s): b0fc80c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -14
app.py CHANGED
@@ -230,7 +230,6 @@ def convert_to_title_case(text: str) -> str:
230
 
231
  run_update_dataset()
232
 
233
- block = gr.Blocks(css=custom_css) # Attach the custom CSS here
234
  with block:
235
  with gr.Row(elem_id="header-row"):
236
  # TITLE IMAGE
@@ -253,25 +252,44 @@ with block:
253
 
254
  path_ = download_leaderboard_dataset()
255
  # gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
 
 
 
 
 
 
 
 
 
 
 
 
256
  # ENVIRONMENT TABS
257
  with gr.Tabs() as tabs: # elem_classes="tab-buttons"
258
  for env_index in range(0, len(hivex_envs)):
259
  hivex_env = hivex_envs[env_index]
260
  with gr.Tab(f"{hivex_env['title']}") as env_tabs:
261
- # TASK TABS
 
262
  for task_id in range(0, hivex_env["task_count"]):
263
- task_title = convert_to_title_case(get_task(hivex_env["hivex_env"], task_id, path_))
264
- with gr.TabItem(f"Task {task_id}: {task_title}"):
265
- with gr.Row():
266
- data = get_data(hivex_env["hivex_env"], task_id, path_)
267
- row_count = len(data) # Number of rows in the data
268
-
269
- gr_dataframe = gr.components.Dataframe(
270
- value=data,
271
- headers=["User", "Model"],
272
- datatype=["markdown", "markdown"],
273
- row_count=(row_count, 'fixed') # Set to the exact number of rows in the data
274
- )
 
 
 
 
 
 
275
 
276
 
277
  scheduler = BackgroundScheduler()
 
230
 
231
  run_update_dataset()
232
 
 
233
  with block:
234
  with gr.Row(elem_id="header-row"):
235
  # TITLE IMAGE
 
252
 
253
  path_ = download_leaderboard_dataset()
254
  # gr.Markdown(INTRODUCTION_TEXT, elem_classes="markdown-text")
255
+
256
+ # Add Checkboxes for Filtering
257
+ with gr.Row():
258
+ selected_patterns = gr.CheckboxGroup(
259
+ choices=["Pattern A", "Pattern B", "Pattern C"],
260
+ label="Select Patterns"
261
+ )
262
+ selected_difficulty = gr.CheckboxGroup(
263
+ choices=["Easy", "Medium", "Hard"],
264
+ label="Select Difficulty"
265
+ )
266
+
267
  # ENVIRONMENT TABS
268
  with gr.Tabs() as tabs: # elem_classes="tab-buttons"
269
  for env_index in range(0, len(hivex_envs)):
270
  hivex_env = hivex_envs[env_index]
271
  with gr.Tab(f"{hivex_env['title']}") as env_tabs:
272
+
273
+ # Apply filtering based on selected checkboxes
274
  for task_id in range(0, hivex_env["task_count"]):
275
+ task_info = get_task(hivex_env["hivex_env"], task_id, path_)
276
+ task_title = convert_to_title_case(task_info)
277
+
278
+ # Example filtering logic based on selected patterns and difficulty
279
+ if (any(pattern in task_info for pattern in selected_patterns.value) and
280
+ any(difficulty in task_info for difficulty in selected_difficulty.value)):
281
+
282
+ with gr.TabItem(f"Task {task_id}: {task_title}"):
283
+ with gr.Row():
284
+ data = get_data(hivex_env["hivex_env"], task_id, path_)
285
+ row_count = len(data) # Number of rows in the data
286
+
287
+ gr_dataframe = gr.components.Dataframe(
288
+ value=data,
289
+ headers=["User", "Model"],
290
+ datatype=["markdown", "markdown"],
291
+ row_count=(row_count, 'fixed') # Set to the exact number of rows in the data
292
+ )
293
 
294
 
295
  scheduler = BackgroundScheduler()