lhoestq HF staff commited on
Commit
2a1cc9d
·
1 Parent(s): 2cc594f
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -121,7 +121,7 @@ with gr.Blocks(css=css) as demo:
121
 
122
  @demo.load(inputs=session_state, outputs=[dataset_dropdown, loading_codes_json, subset_dropdown, split_dropdown, dataframe, session_state, share_link_textbox, use_locally_markdown, prev_button, next_button, page_html])
123
  def _fetch_datasets(session: str | None, request: gr.Request):
124
- datasets = ["CohereForAI/Global-MMLU"] + list(HfApi().list_datasets(limit=NUM_TRENDING_DATASETS, sort="trendingScore", direction=-1, filter=["format:parquet"]))
125
  session = request.query_params.get(SESSIONS_DIR) or session
126
  if session:
127
  namespace, dataset_name, subset, split, _ = session.split("--")
@@ -130,7 +130,7 @@ with gr.Blocks(css=css) as demo:
130
  session = None
131
  dataset = request.query_params["dataset"]
132
  else:
133
- dataset = request.query_params.get("dataset") or datasets[0].id
134
  subsets, loading_codes = show_subset_dropdown(dataset)
135
  subsets["value"] = subset if session else subsets["value"]
136
  splits = show_split_dropdown(subsets["value"], loading_codes)
@@ -139,7 +139,7 @@ with gr.Blocks(css=css) as demo:
139
  page = 1
140
  input_dataframe = show_input_dataframe(dataset, subsets["value"], splits["value"], loading_codes, session, page)
141
  return {
142
- dataset_dropdown: gr.Dropdown(choices=[dataset.id for dataset in datasets], value=dataset),
143
  loading_codes_json: loading_codes,
144
  subset_dropdown: gr.Dropdown(**subsets),
145
  split_dropdown: gr.Dropdown(**splits),
 
121
 
122
  @demo.load(inputs=session_state, outputs=[dataset_dropdown, loading_codes_json, subset_dropdown, split_dropdown, dataframe, session_state, share_link_textbox, use_locally_markdown, prev_button, next_button, page_html])
123
  def _fetch_datasets(session: str | None, request: gr.Request):
124
+ datasets = ["CohereForAI/Global-MMLU"] + [ds.id for ds in HfApi().list_datasets(limit=NUM_TRENDING_DATASETS, sort="trendingScore", direction=-1, filter=["format:parquet"])]
125
  session = request.query_params.get(SESSIONS_DIR) or session
126
  if session:
127
  namespace, dataset_name, subset, split, _ = session.split("--")
 
130
  session = None
131
  dataset = request.query_params["dataset"]
132
  else:
133
+ dataset = request.query_params.get("dataset") or datasets[0]
134
  subsets, loading_codes = show_subset_dropdown(dataset)
135
  subsets["value"] = subset if session else subsets["value"]
136
  splits = show_split_dropdown(subsets["value"], loading_codes)
 
139
  page = 1
140
  input_dataframe = show_input_dataframe(dataset, subsets["value"], splits["value"], loading_codes, session, page)
141
  return {
142
+ dataset_dropdown: gr.Dropdown(choices=datasets, value=dataset),
143
  loading_codes_json: loading_codes,
144
  subset_dropdown: gr.Dropdown(**subsets),
145
  split_dropdown: gr.Dropdown(**splits),