Update app.py
Browse files
app.py
CHANGED
@@ -249,13 +249,21 @@ def get_difficulty_pattern_ids_and_key(rl_env, path):
|
|
249 |
csv_path = path + "/" + rl_env + ".csv"
|
250 |
data = pd.read_csv(csv_path)
|
251 |
|
252 |
-
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
|
256 |
return key, difficulty_pattern_ids
|
257 |
|
258 |
|
|
|
259 |
run_update_dataset()
|
260 |
|
261 |
block = gr.Blocks(css=custom_css) # Attach the custom CSS here
|
@@ -291,10 +299,10 @@ with block:
|
|
291 |
hivex_env = hivex_envs[env_index]
|
292 |
with gr.Tab(f"{hivex_env['title']}") as env_tabs:
|
293 |
# ADD CHECK BOX GROUP TO SELECT DIFFICULTY / PATTERN IDs
|
294 |
-
dp_key
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
|
299 |
# TASK TABS
|
300 |
for task_id in range(0, hivex_env["task_count"]):
|
|
|
249 |
csv_path = path + "/" + rl_env + ".csv"
|
250 |
data = pd.read_csv(csv_path)
|
251 |
|
252 |
+
if "Pattern" in data.columns:
|
253 |
+
key = "Pattern"
|
254 |
+
difficulty_pattern_ids = data[key].unique()
|
255 |
+
elif "Difficulty" in data.columns:
|
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 |
|
266 |
+
|
267 |
run_update_dataset()
|
268 |
|
269 |
block = gr.Blocks(css=custom_css) # Attach the custom CSS here
|
|
|
299 |
hivex_env = hivex_envs[env_index]
|
300 |
with gr.Tab(f"{hivex_env['title']}") as env_tabs:
|
301 |
# ADD CHECK BOX GROUP TO SELECT DIFFICULTY / PATTERN IDs
|
302 |
+
if dp_key is not None:
|
303 |
+
gr.CheckboxGroup([str(dp_id) for dp_id in difficulty_pattern_ids], label=dp_key)
|
304 |
+
else:
|
305 |
+
gr.HTML("<p>No difficulty or pattern data available for this environment.</p>")
|
306 |
|
307 |
# TASK TABS
|
308 |
for task_id in range(0, hivex_env["task_count"]):
|