Update app.py
Browse files
app.py
CHANGED
@@ -58,16 +58,15 @@ async def update_configs(dataset_name: str):
|
|
58 |
try:
|
59 |
splits = await get_splits(dataset_name)
|
60 |
all_configs = sorted(set([s["config"] for s in splits["splits"]]))
|
61 |
-
return (
|
62 |
-
splits)
|
63 |
except json.JSONDecodeError:
|
64 |
-
return
|
65 |
|
66 |
async def update_splits(config_name: str, state: gr.State):
|
67 |
splits_for_config = sorted(set([s["split"] for s in state["splits"] if s["config"] == config_name]))
|
68 |
dataset_name = state["splits"][0]["dataset"] if state["splits"] else None
|
69 |
dataset = await update_dataset(splits_for_config[0], config_name, dataset_name) if splits_for_config and dataset_name else gr.DataFrame.update()
|
70 |
-
return
|
71 |
|
72 |
async def update_dataset(split_name: str, config_name: str, dataset_name: str):
|
73 |
rows = await get_first_rows(dataset_name, config_name, split_name)
|
|
|
58 |
try:
|
59 |
splits = await get_splits(dataset_name)
|
60 |
all_configs = sorted(set([s["config"] for s in splits["splits"]]))
|
61 |
+
return (all_configs, all_configs[0] if all_configs else None), splits
|
|
|
62 |
except json.JSONDecodeError:
|
63 |
+
return [], None, {"splits": []}
|
64 |
|
65 |
async def update_splits(config_name: str, state: gr.State):
|
66 |
splits_for_config = sorted(set([s["split"] for s in state["splits"] if s["config"] == config_name]))
|
67 |
dataset_name = state["splits"][0]["dataset"] if state["splits"] else None
|
68 |
dataset = await update_dataset(splits_for_config[0], config_name, dataset_name) if splits_for_config and dataset_name else gr.DataFrame.update()
|
69 |
+
return splits_for_config, splits_for_config[0] if splits_for_config else None, dataset
|
70 |
|
71 |
async def update_dataset(split_name: str, config_name: str, dataset_name: str):
|
72 |
rows = await get_first_rows(dataset_name, config_name, split_name)
|