lhoestq HF staff commited on
Commit
bf76396
β€’
1 Parent(s): da99fed

vertical UI + add examples

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -53,24 +53,24 @@ def analyze_dataset(dataset: str) -> pd.DataFrame:
53
  rows, scanned_columns=scanned_columns, columns_descriptions=columns_descriptions
54
  ):
55
  presidio_entities.append(presidio_entity)
56
- yield f"βš™οΈ Scanning {dataset} [{rows.next_idx} / {num_rows}]:", pd.DataFrame(presidio_entities)
57
- yield f"βœ… Scanning {dataset} [{rows.next_idx} / {num_rows}]:", pd.DataFrame(presidio_entities)
58
 
59
- demo = gr.Interface(
60
- fn=analyze_dataset,
61
- inputs=[
62
  HuggingfaceHubSearch(
63
  label="Hub Dataset ID",
64
  placeholder="Search for dataset id on Huggingface",
65
  search_type="dataset",
66
  ),
67
- ],
68
- outputs=[
 
69
  gr.Markdown(),
70
  gr.DataFrame(),
71
- ],
72
- title="Scan datasets using Presidio",
73
- description="The space takes an HF dataset name as an input, and returns the list of entities detected by Presidio in the first samples.",
74
- )
75
 
76
  demo.launch()
 
53
  rows, scanned_columns=scanned_columns, columns_descriptions=columns_descriptions
54
  ):
55
  presidio_entities.append(presidio_entity)
56
+ yield f"βš™οΈ Scanning {dataset} [{rows.next_idx}/{num_rows} rows]:", pd.DataFrame(presidio_entities)
57
+ yield f"βœ… Scanning {dataset} [{rows.next_idx}/{num_rows}rows]:", pd.DataFrame(presidio_entities)
58
 
59
+ with gr.Block(title="Scan datasets using Presidio") as demo:
60
+ gr.Markdown("The space takes an HF dataset name as an input, and returns the list of entities detected by Presidio in the first samples.")
61
+ inputs = [
62
  HuggingfaceHubSearch(
63
  label="Hub Dataset ID",
64
  placeholder="Search for dataset id on Huggingface",
65
  search_type="dataset",
66
  ),
67
+ ]
68
+ button = gr.Button("Run Presidio Scan")
69
+ outputs = [
70
  gr.Markdown(),
71
  gr.DataFrame(),
72
+ ]
73
+ button.click(analyze_dataset, inputs, outputs)
74
+ gr.Examples(["microsoft/orca-math-word-problems-200k", "yahma/alpaca-cleaned", "Anthropic/persuasion", ""])
 
75
 
76
  demo.launch()