Spaces:
Sleeping
Sleeping
update
Browse files
app.py
CHANGED
@@ -24,9 +24,11 @@ def load_data(language, ext, min_alphanum, max_line_length, max_mean_line_length
|
|
24 |
data_dir=f"data/{language}/{ext}",
|
25 |
split="train",
|
26 |
)
|
27 |
-
samples = samples.filter(
|
28 |
-
|
29 |
-
|
|
|
|
|
30 |
if non_lexable:
|
31 |
samples = samples.filter(lambda x: not x["lexable"])
|
32 |
return samples
|
@@ -44,7 +46,7 @@ with col2:
|
|
44 |
st.sidebar.header("Filters")
|
45 |
not_lexable = st.sidebar.checkbox("Not lexable")
|
46 |
min_alphanum = st.sidebar.slider("Minimum alphanumeric fraction", 0.0, 1.0, 1.0)
|
47 |
-
max_line_length = st.sidebar.slider("Maximum line length", 0,
|
48 |
max_mean_line_length = st.sidebar.slider("Maximum average line length", 0, 500, 0, step=100)
|
49 |
st.sidebar.markdown("Printed files have `max_line_length` and `average_line_length` larger than the selected values.\
|
50 |
`alphanumeric_fraction` is smaller than the selected value.")
|
|
|
24 |
data_dir=f"data/{language}/{ext}",
|
25 |
split="train",
|
26 |
)
|
27 |
+
samples = samples.filter(
|
28 |
+
lambda x: x["alphanum_fraction"] < min_alphanum
|
29 |
+
and x["max_line_length"] > max_line_length
|
30 |
+
and x["avg_line_length"] > max_mean_line_length
|
31 |
+
)
|
32 |
if non_lexable:
|
33 |
samples = samples.filter(lambda x: not x["lexable"])
|
34 |
return samples
|
|
|
46 |
st.sidebar.header("Filters")
|
47 |
not_lexable = st.sidebar.checkbox("Not lexable")
|
48 |
min_alphanum = st.sidebar.slider("Minimum alphanumeric fraction", 0.0, 1.0, 1.0)
|
49 |
+
max_line_length = st.sidebar.slider("Maximum line length", 0, 1200, 0, step=100)
|
50 |
max_mean_line_length = st.sidebar.slider("Maximum average line length", 0, 500, 0, step=100)
|
51 |
st.sidebar.markdown("Printed files have `max_line_length` and `average_line_length` larger than the selected values.\
|
52 |
`alphanumeric_fraction` is smaller than the selected value.")
|