red1xe commited on
Commit
01ac5bc
1 Parent(s): 5f6b2a6

some changes

Browse files
Files changed (1) hide show
  1. app.py +7 -14
app.py CHANGED
@@ -30,17 +30,10 @@ if files:
30
  embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
31
  db = FAISS.from_texts(chunks, embeddings)
32
  memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True,)
33
-
34
- def retrieve_info(query):
35
- similar_response = db.similarity_search(query, k=3)
36
- page_contents_array = [doc.page_contents for doc in similar_response]
37
- page_contents = " ".join(page_contents_array)
38
- return page_contents
39
-
40
- st.header("Chatbot")
41
- st.subheader("Ask a question")
42
- question = st.text_input("Question")
43
- if question:
44
- st.subheader("Answer")
45
- answer = retrieve_info(question)
46
- st.write(answer)
 
30
  embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
31
  db = FAISS.from_texts(chunks, embeddings)
32
  memory = ConversationBufferMemory(memory_key='chat_history', return_messages=True,)
33
+ st.header("Chatbot")
34
+ st.subheader("Ask a question")
35
+ question = st.text_input("Question")
36
+ similar_response = db.similarity_search(query=question, k=3)
37
+ page_contents_array = [doc.page_contents for doc in similar_response]
38
+ page_contents = " ".join(page_contents_array)
39
+ st.write(page_contents)