polinaeterna commited on
Commit
20e02d9
·
verified ·
1 Parent(s): bfdafcc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gd
2
+ import polars as pl
3
+
4
+
5
+ data = pl.read_parquet("hf://datasets/polinaeterna/text_unnested/data/*.parquet")
6
+ min_min = data["min"].min()
7
+ min_max = data["max"].max()
8
+
9
+
10
+ def filter(min_value: min_min, max_value: min_max):
11
+ df = data.select((pl.col("min") >= min_value) & (pl.col("min") <= max_value)).to_pandas()
12
+ if df.shape[0] > 100:
13
+ return df.head(100)
14
+ return df
15
+
16
+
17
+ with gr.Blocks() as demo:
18
+ gr.Markdown("# 💫 Filter text datasets by string lengths distribution 💫")
19
+ min_value = gr.Slider(min_min, min_max, 0, step=1, label="Min min value")
20
+ max_value = gr.Slider(min_min, min_max, 0, step=1, label="Max min value")
21
+ btn = gr.Button("Get datasets ")
22
+ datasets = gr.DataFrame()
23
+ btn.click(filter, inputs=[min_value, max_value], outputs=[datasets])
24
+
25
+ demo.launch(debug=True)