lhoestq HF staff commited on
Commit
cacfe13
Β·
1 Parent(s): daa36b9
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -106,7 +106,7 @@ def get_page(dataset: str, config: str, split: str, page: str) -> Tuple[str, int
106
 
107
 
108
  with gr.Blocks() as demo:
109
- gr.Markdown("# πŸ“– Dataset Explorer\n\nAccess any slice of data of any dataset on the [Hugging Face Dataset Hub](https://huggingface.co/datasets)")
110
  cp_dataset = gr.Textbox("squad", label="Pick a dataset", placeholder="squad")
111
  cp_go = gr.Button("Explore")
112
  cp_config = gr.Dropdown(["plain_text"], value="plain_text", label="Config", visible=False)
@@ -124,14 +124,14 @@ with gr.Blocks() as demo:
124
  cp_info: gr.update(visible=False, value=""),
125
  cp_result: gr.update(visible=False, value=""),
126
  }
127
-
128
  def show_dataset_at_config_and_split_and_page(dataset: str, config: str, split: str, page: str) -> dict:
129
  try:
130
  jsonl_result, max_page, info = get_page(dataset, config, split, page)
131
  info = f"({info})" if info else ""
132
  return {
133
  cp_result: gr.update(visible=True, value=f"```json\n{jsonl_result}\n```"),
134
- cp_info: gr.update(visible=True, value=f"Page {page}/{max_page}) {info}"),
135
  cp_error: gr.update(visible=False, value="")
136
  }
137
  except AppError as err:
 
106
 
107
 
108
  with gr.Blocks() as demo:
109
+ gr.Markdown("# πŸ“– Datasets Explorer\n\nAccess any slice of data of any dataset on the [Hugging Face Dataset Hub](https://huggingface.co/datasets)")
110
  cp_dataset = gr.Textbox("squad", label="Pick a dataset", placeholder="squad")
111
  cp_go = gr.Button("Explore")
112
  cp_config = gr.Dropdown(["plain_text"], value="plain_text", label="Config", visible=False)
 
124
  cp_info: gr.update(visible=False, value=""),
125
  cp_result: gr.update(visible=False, value=""),
126
  }
127
+
128
  def show_dataset_at_config_and_split_and_page(dataset: str, config: str, split: str, page: str) -> dict:
129
  try:
130
  jsonl_result, max_page, info = get_page(dataset, config, split, page)
131
  info = f"({info})" if info else ""
132
  return {
133
  cp_result: gr.update(visible=True, value=f"```json\n{jsonl_result}\n```"),
134
+ cp_info: gr.update(visible=True, value=f"Page {page}/{max_page} {info}"),
135
  cp_error: gr.update(visible=False, value="")
136
  }
137
  except AppError as err: