philippds commited on
Commit
d8b6e42
·
verified ·
1 Parent(s): cebeee5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -21
app.py CHANGED
@@ -325,36 +325,35 @@ with block:
325
  [str(dp_id) for dp_id in difficulty_pattern_ids], label=dp_key
326
  )
327
 
328
- for task_id in range(0, hivex_env["task_count"]):
329
- task_title = convert_to_title_case(
330
- get_task(hivex_env["hivex_env"], task_id, path_)
331
- )
332
- with gr.TabItem(f"Task {task_id}: {task_title}"):
333
 
334
- # Display initial data
335
- data = get_data(hivex_env["hivex_env"], task_id, path_)
336
- row_count = len(data)
337
 
338
- gr_dataframe = gr.DataFrame(
339
- value=data,
340
- headers=["User", "Model"],
341
- datatype=["markdown", "markdown"],
342
- row_count=(row_count, "fixed"),
343
- )
344
 
345
- # Use gr.State to hold environment and task information
346
- rl_env_state = gr.State(value=hivex_env["hivex_env"])
347
- task_id_state = gr.State(value=task_id)
348
- path_state = gr.State(value=path_)
349
 
350
- # Add a callback to update the DataFrame when checkboxes are changed
 
351
  selected_checkboxes.change(
352
  fn=update_filtered_data,
353
  inputs=[selected_checkboxes, rl_env_state, task_id_state, path_state],
354
  outputs=gr_dataframe,
355
  )
356
- else:
357
- gr.HTML("<p>No difficulty or pattern data available for this environment.</p>")
358
 
359
  scheduler = BackgroundScheduler()
360
  scheduler.add_job(restart, "interval", seconds=86400)
 
325
  [str(dp_id) for dp_id in difficulty_pattern_ids], label=dp_key
326
  )
327
 
328
+ for task_id in range(0, hivex_env["task_count"]):
329
+ task_title = convert_to_title_case(
330
+ get_task(hivex_env["hivex_env"], task_id, path_)
331
+ )
332
+ with gr.TabItem(f"Task {task_id}: {task_title}"):
333
 
334
+ # Display initial data
335
+ data = get_data(hivex_env["hivex_env"], task_id, path_)
336
+ row_count = len(data)
337
 
338
+ gr_dataframe = gr.DataFrame(
339
+ value=data,
340
+ headers=["User", "Model"],
341
+ datatype=["markdown", "markdown"],
342
+ row_count=(row_count, "fixed"),
343
+ )
344
 
345
+ # Use gr.State to hold environment and task information
346
+ rl_env_state = gr.State(value=hivex_env["hivex_env"])
347
+ task_id_state = gr.State(value=task_id)
348
+ path_state = gr.State(value=path_)
349
 
350
+ # Add a callback to update the DataFrame when checkboxes are changed
351
+ if selected_checkboxes:
352
  selected_checkboxes.change(
353
  fn=update_filtered_data,
354
  inputs=[selected_checkboxes, rl_env_state, task_id_state, path_state],
355
  outputs=gr_dataframe,
356
  )
 
 
357
 
358
  scheduler = BackgroundScheduler()
359
  scheduler.add_job(restart, "interval", seconds=86400)