some changes
Browse files
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 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|