nibas commited on
Commit
2b5dd62
·
verified ·
1 Parent(s): 04d410e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -16,7 +16,7 @@ my_initial_rag_text = f"""This is a RAG (Retrieval-Augmented Generation) chatbot
16
  - Uses Streamlit for the web interface
17
  - Employs SentenceTransformer for generating embeddings
18
  - Uses HuggingFace's InferenceClient for LLM interaction
19
- - Has a default text about a GRNET training module on LLMs
20
 
21
  2. State Management:
22
  - Maintains several session state variables for:
@@ -130,7 +130,7 @@ By using the Software, you agree to the terms and conditions of the disclaimer."
130
 
131
  # Check if the sentences are not already in the session state
132
  if "my_sentences" not in st.session_state:
133
- my_sentences_split = st.session_state["my_rag_text"].split(".")
134
  st.session_state["my_sentences"] = []
135
  for my_sentence in my_sentences_split:
136
  if my_sentence.strip():
@@ -166,7 +166,7 @@ with column_2:
166
  similarity_to_question = cosine_similarity(my_question_embedding, st.session_state.my_embeddings).flatten()
167
 
168
  # Number of sentences to keep based on similarity
169
- nof_keep_sentences = 3
170
 
171
  # Get the indices of the top similar sentences
172
  sorted_indices = similarity_to_question.argsort()[::-1][:nof_keep_sentences]
 
16
  - Uses Streamlit for the web interface
17
  - Employs SentenceTransformer for generating embeddings
18
  - Uses HuggingFace's InferenceClient for LLM interaction
19
+ - Has a default text about a training module on LLMs
20
 
21
  2. State Management:
22
  - Maintains several session state variables for:
 
130
 
131
  # Check if the sentences are not already in the session state
132
  if "my_sentences" not in st.session_state:
133
+ my_sentences_split = st.session_state["my_rag_text"].split("\n")
134
  st.session_state["my_sentences"] = []
135
  for my_sentence in my_sentences_split:
136
  if my_sentence.strip():
 
166
  similarity_to_question = cosine_similarity(my_question_embedding, st.session_state.my_embeddings).flatten()
167
 
168
  # Number of sentences to keep based on similarity
169
+ nof_keep_sentences = 10
170
 
171
  # Get the indices of the top similar sentences
172
  sorted_indices = similarity_to_question.argsort()[::-1][:nof_keep_sentences]