philippds commited on
Commit
ebb3370
·
verified ·
1 Parent(s): 9f567b2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -21
app.py CHANGED
@@ -256,13 +256,12 @@ def get_difficulty_pattern_ids_and_key(rl_env, path):
256
  key = "Difficulty"
257
  difficulty_pattern_ids = data[key].unique()
258
  else:
259
- # Handle the case where neither 'Pattern' nor 'Difficulty' columns exist
260
  key = None
261
  difficulty_pattern_ids = []
262
 
263
  return key, difficulty_pattern_ids
264
 
265
- def filter_checkbox_data(rl_env, task_id, selected_values, path):
266
  """
267
  Filters the data based on the selected difficulty/pattern values.
268
  """
@@ -274,13 +273,13 @@ def filter_checkbox_data(rl_env, task_id, selected_values, path):
274
  data = data[data[filter_column].isin(selected_values)]
275
 
276
  return data
 
277
 
278
  run_update_dataset()
279
 
280
  block = gr.Blocks(css=custom_css) # Attach the custom CSS here
281
  with block:
282
  with gr.Row(elem_id="header-row"):
283
- # TITLE IMAGE
284
  gr.HTML(
285
  """
286
  <div style="width: 50%; margin: 0 auto; text-align: center;">
@@ -304,23 +303,6 @@ with block:
304
 
305
  path_ = download_leaderboard_dataset()
306
 
307
- def filter_data(rl_env, task_id, selected_values, path):
308
- """
309
- Filters the data based on the selected difficulty/pattern values.
310
- """
311
- data = get_data(rl_env, task_id, path)
312
-
313
- # If there are selected values, filter the DataFrame
314
- if selected_values:
315
- filter_column = "Pattern" if "Pattern" in data.columns else "Difficulty"
316
- data = data[data[filter_column].isin(selected_values)]
317
-
318
- return data
319
-
320
- def update_filtered_data(selected_values, rl_env, task_id, path):
321
- filtered_data = filter_data(rl_env, task_id, selected_values, path)
322
- return filtered_data
323
-
324
  # ENVIRONMENT TABS
325
  with gr.Tabs() as tabs:
326
  for env_index in range(0, len(hivex_envs)):
@@ -366,4 +348,4 @@ scheduler = BackgroundScheduler()
366
  scheduler.add_job(restart, "interval", seconds=86400)
367
  scheduler.start()
368
 
369
- block.launch()
 
256
  key = "Difficulty"
257
  difficulty_pattern_ids = data[key].unique()
258
  else:
 
259
  key = None
260
  difficulty_pattern_ids = []
261
 
262
  return key, difficulty_pattern_ids
263
 
264
+ def filter_data(rl_env, task_id, selected_values, path):
265
  """
266
  Filters the data based on the selected difficulty/pattern values.
267
  """
 
273
  data = data[data[filter_column].isin(selected_values)]
274
 
275
  return data
276
+
277
 
278
  run_update_dataset()
279
 
280
  block = gr.Blocks(css=custom_css) # Attach the custom CSS here
281
  with block:
282
  with gr.Row(elem_id="header-row"):
 
283
  gr.HTML(
284
  """
285
  <div style="width: 50%; margin: 0 auto; text-align: center;">
 
303
 
304
  path_ = download_leaderboard_dataset()
305
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  # ENVIRONMENT TABS
307
  with gr.Tabs() as tabs:
308
  for env_index in range(0, len(hivex_envs)):
 
348
  scheduler.add_job(restart, "interval", seconds=86400)
349
  scheduler.start()
350
 
351
+ block.launch()