Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,9 +8,9 @@ st.markdown("<h1 style='text-align: center; color: #00BFFF;'>Kaggle Notebooks in
|
|
| 8 |
|
| 9 |
st.markdown("Here you can inspect Kaggle notebooks that were converted to python scripts and deduplicated.")
|
| 10 |
@st.cache()
|
| 11 |
-
def load_data(upvote=0):
|
| 12 |
ds = load_dataset("loubnabnl/subset_kaggle_scripts", split="train")
|
| 13 |
-
ds = ds.filter(lambda x: x["upvotes"] >= upvote)
|
| 14 |
return ds
|
| 15 |
|
| 16 |
def show_extra_info(e):
|
|
@@ -32,7 +32,8 @@ def show_extra_info(e):
|
|
| 32 |
|
| 33 |
|
| 34 |
vote = st.sidebar.slider("Minimum notebook ⬆️ upvotes", min_value=0, max_value=100, step=1, value=0)
|
| 35 |
-
|
|
|
|
| 36 |
index_example = st.sidebar.number_input(f"Choose a sample from the existing {len(samples)} notebooks:", min_value=0, max_value=max(0, len(samples)-1), value=0, step=1)
|
| 37 |
|
| 38 |
st.markdown(show_extra_info(samples[index_example]), unsafe_allow_html=True)
|
|
|
|
| 8 |
|
| 9 |
st.markdown("Here you can inspect Kaggle notebooks that were converted to python scripts and deduplicated.")
|
| 10 |
@st.cache()
|
| 11 |
+
def load_data(upvote=0, size=0):
|
| 12 |
ds = load_dataset("loubnabnl/subset_kaggle_scripts", split="train")
|
| 13 |
+
ds = ds.filter(lambda x: x["upvotes"] >= upvote and x["seq_len"] >= size)
|
| 14 |
return ds
|
| 15 |
|
| 16 |
def show_extra_info(e):
|
|
|
|
| 32 |
|
| 33 |
|
| 34 |
vote = st.sidebar.slider("Minimum notebook ⬆️ upvotes", min_value=0, max_value=100, step=1, value=0)
|
| 35 |
+
size = st.sidebar.slider("Length of the notebook in number of tokens", min_value=0, max_value=15_000, step=1000, value=0)
|
| 36 |
+
samples = load_data(vote, size)
|
| 37 |
index_example = st.sidebar.number_input(f"Choose a sample from the existing {len(samples)} notebooks:", min_value=0, max_value=max(0, len(samples)-1), value=0, step=1)
|
| 38 |
|
| 39 |
st.markdown(show_extra_info(samples[index_example]), unsafe_allow_html=True)
|