Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,16 +43,20 @@ topics, probs = fit_transform(topic_model, tiktok)
|
|
| 43 |
placeholder = st.empty()
|
| 44 |
text_input = placeholder.text_area("Enter product topic here", height=300)
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
|
|
|
| 43 |
placeholder = st.empty()
|
| 44 |
text_input = placeholder.text_area("Enter product topic here", height=300)
|
| 45 |
|
| 46 |
+
top_n = st.sidebar.slider("Select a number of keywords", 1, 10, 5, 1)
|
| 47 |
+
|
| 48 |
+
similar_topics, similarity = topic_model.find_topics(text_input, top_n=top_n)
|
| 49 |
+
|
| 50 |
+
if similar_topics != []:
|
| 51 |
+
most_similar = similar_topics[0]
|
| 52 |
+
print(similar_topics[0])
|
| 53 |
+
print("Most Similar Topic Info: \n{}".format(topic_model.get_topic(most_similar)))
|
| 54 |
+
print("Similarity Score: {}".format(similarity[0]))
|
| 55 |
+
|
| 56 |
+
answer_as_string = topic_model.get_topic(most_similar)
|
| 57 |
+
|
| 58 |
+
st.info("Extracted Topic")
|
| 59 |
+
st.text_area("Most Similar Topic List is Here",answer_as_string,key="topic_list")
|
| 60 |
+
st.image('https://freepngimg.com/download/keyboard/6-2-keyboard-png-file.png',use_column_width=True)
|
| 61 |
+
st.markdown("<h6 style='text-align: center; color: #808080;'>Created By LiHE</a></h6>", unsafe_allow_html=True)
|
| 62 |
|