Spaces:
Running
Running
Update streamlit_app_LDA.py
Browse files- streamlit_app_LDA.py +6 -5
streamlit_app_LDA.py
CHANGED
@@ -17,6 +17,8 @@ from MIND_utils import df_to_self_states_json, element_short_desc_map
|
|
17 |
st.set_page_config(layout="wide")
|
18 |
st.title("Prototypical Self-States via Topic Modeling")
|
19 |
|
|
|
|
|
20 |
st.header("Model Parameters")
|
21 |
lda_document_is = st.radio("A 'Document' in the topic model will correspond to a:", ("self-state", "segment"))
|
22 |
num_topics = st.slider("Number of Topics", min_value=2, max_value=20, value=5)
|
@@ -44,12 +46,11 @@ show_long_elements = st.checkbox("Show full element name")
|
|
44 |
# ---------------------------
|
45 |
# Load Data
|
46 |
# ---------------------------
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
return pd.read_csv("clean_annotations_safe.csv")
|
51 |
|
52 |
-
df = load_data()
|
53 |
|
54 |
# ---------------------------
|
55 |
# Preprocess Data: Build Documents
|
|
|
17 |
st.set_page_config(layout="wide")
|
18 |
st.title("Prototypical Self-States via Topic Modeling")
|
19 |
|
20 |
+
uploaded_file = st.file_uploader("Upload your own data file (CSV)", type="csv")
|
21 |
+
|
22 |
st.header("Model Parameters")
|
23 |
lda_document_is = st.radio("A 'Document' in the topic model will correspond to a:", ("self-state", "segment"))
|
24 |
num_topics = st.slider("Number of Topics", min_value=2, max_value=20, value=5)
|
|
|
46 |
# ---------------------------
|
47 |
# Load Data
|
48 |
# ---------------------------
|
49 |
+
@st.cache_data
|
50 |
+
def load_data(csv):
|
51 |
+
return pd.read_csv(csv)
|
|
|
52 |
|
53 |
+
df = load_data(uploaded_file or "clean_annotations_safe.csv")
|
54 |
|
55 |
# ---------------------------
|
56 |
# Preprocess Data: Build Documents
|