blazingbunny commited on
Commit
b1f50e9
·
verified ·
1 Parent(s): dca0206

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -4
app.py CHANGED
@@ -30,10 +30,20 @@ def display_top_5(similarities):
30
  for word, similarity in top_5_similarities:
31
  st.write(f"- '{word}': {similarity:.4f}")
32
 
33
-
34
  # Streamlit interface
35
  st.title("Sentence Similarity Checker")
36
 
 
 
 
 
 
 
 
 
 
 
 
37
  reference_word = st.text_input("Enter the reference Sentence:")
38
  word_list = st.text_area("Enter a list of sentences or phrases (one word per line):")
39
 
@@ -45,9 +55,7 @@ if st.button("Analyze"):
45
  similarity = calculate_similarity(reference_word, word)
46
  similarities.append((word, similarity))
47
 
48
- # Find top 5 (We should only do this once outside the loop)
49
  display_top_5(similarities)
50
  else:
51
  st.warning("Please enter a reference word and a list of words.")
52
-
53
-
 
30
  for word, similarity in top_5_similarities:
31
  st.write(f"- '{word}': {similarity:.4f}")
32
 
 
33
  # Streamlit interface
34
  st.title("Sentence Similarity Checker")
35
 
36
+ # Instructions in the sidebar
37
+ st.sidebar.title("Instructions")
38
+ st.sidebar.write("""
39
+ 1. **Enter the Reference Sentence**: Input the sentence or phrase you want to compare against others.
40
+ 2. **Input a List of Sentences**: Enter multiple sentences or phrases, each on a new line, in the text area.
41
+ 3. **Click 'Analyze'**: The app will calculate and display the top 5 most similar sentences.
42
+ 4. **Results**: The top 5 similar sentences along with their similarity scores will be displayed.
43
+ 5. **Warnings**: If either the reference sentence or the list of sentences is missing, a warning will be shown.
44
+ """)
45
+
46
+ # Main input area
47
  reference_word = st.text_input("Enter the reference Sentence:")
48
  word_list = st.text_area("Enter a list of sentences or phrases (one word per line):")
49
 
 
55
  similarity = calculate_similarity(reference_word, word)
56
  similarities.append((word, similarity))
57
 
58
+ # Find top 5 (We should only do this once outside the loop)
59
  display_top_5(similarities)
60
  else:
61
  st.warning("Please enter a reference word and a list of words.")