Update app.py
Browse files
app.py
CHANGED
|
@@ -16,19 +16,19 @@ Additionally, the model was tasked with finding the topic of each cluster.
|
|
| 16 |
""")
|
| 17 |
|
| 18 |
@st.cache_data
|
| 19 |
-
def load_data(
|
| 20 |
ds = load_dataset("HuggingFaceTB/FW_clusters_free_topics", split="train", token=HF_TOKEN, num_proc=2)
|
| 21 |
ds = ds.filter(lambda x: x['educational_score'] <= max_score and x['educational_score'] >= min_score)
|
| 22 |
return ds
|
| 23 |
|
| 24 |
st.subheader("Cluster information")
|
| 25 |
-
|
| 26 |
-
with
|
| 27 |
min_value = st.slider('Select minimum educational score', 1, 10, 1, key='min_score')
|
| 28 |
-
with
|
| 29 |
max_value = st.slider('Select maximum educational score', 1, 10, 10, key='max_score')
|
| 30 |
|
| 31 |
-
ds = load_data(
|
| 32 |
selected_category_type = st.selectbox("Select a topic", categories)
|
| 33 |
categories = list(set(ds["category"]))
|
| 34 |
selected_cluster = ds.filter(lambda x: x['category'] == selected_category)
|
|
|
|
| 16 |
""")
|
| 17 |
|
| 18 |
@st.cache_data
|
| 19 |
+
def load_data(min=1, max=10):
|
| 20 |
ds = load_dataset("HuggingFaceTB/FW_clusters_free_topics", split="train", token=HF_TOKEN, num_proc=2)
|
| 21 |
ds = ds.filter(lambda x: x['educational_score'] <= max_score and x['educational_score'] >= min_score)
|
| 22 |
return ds
|
| 23 |
|
| 24 |
st.subheader("Cluster information")
|
| 25 |
+
col_1, col_2 = st.columns(2)
|
| 26 |
+
with col_1:
|
| 27 |
min_value = st.slider('Select minimum educational score', 1, 10, 1, key='min_score')
|
| 28 |
+
with col_2:
|
| 29 |
max_value = st.slider('Select maximum educational score', 1, 10, 10, key='max_score')
|
| 30 |
|
| 31 |
+
ds = load_data(min_value, max_value)
|
| 32 |
selected_category_type = st.selectbox("Select a topic", categories)
|
| 33 |
categories = list(set(ds["category"]))
|
| 34 |
selected_cluster = ds.filter(lambda x: x['category'] == selected_category)
|