prsdm commited on
Commit
e76ce7b
β€’
1 Parent(s): 01d270e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -3,7 +3,7 @@ import os
3
  import streamlit as st
4
  from PyPDF2 import PdfReader
5
  from langchain.text_splitter import CharacterTextSplitter
6
- from langchain.embeddings import HuggingFaceBgeEmbeddings
7
  from langchain.vectorstores import FAISS
8
  from langchain.memory import ConversationBufferMemory
9
  from langchain.chains import ConversationalRetrievalChain
@@ -29,11 +29,11 @@ def get_text_chunks(text):
29
 
30
 
31
  def get_vectorstore(text_chunks):
32
- model = "BAAI/bge-base-en-v1.5"
33
  encode_kwargs = {
34
  "normalize_embeddings": True
35
  }
36
- embeddings = HuggingFaceBgeEmbeddings(
37
  model_name=model, encode_kwargs=encode_kwargs, model_kwargs={"device": "cpu"}
38
  )
39
  vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
@@ -70,7 +70,7 @@ def main():
70
  page_icon="πŸ“„",
71
  )
72
 
73
- st.markdown("# Chat with multiple PDFs πŸ“„")
74
 
75
  st.write(css, unsafe_allow_html=True)
76
 
@@ -90,7 +90,7 @@ def main():
90
 
91
  with st.sidebar:
92
  st.subheader("Your documents")
93
- st.text_input("You can upload multiple files at once")
94
  pdf_docs = st.file_uploader(
95
  "Upload your PDFs here and click on 'Process'", accept_multiple_files=True
96
  )
 
3
  import streamlit as st
4
  from PyPDF2 import PdfReader
5
  from langchain.text_splitter import CharacterTextSplitter
6
+ from langchain.embeddings import HuggingFaceEmbeddings
7
  from langchain.vectorstores import FAISS
8
  from langchain.memory import ConversationBufferMemory
9
  from langchain.chains import ConversationalRetrievalChain
 
29
 
30
 
31
  def get_vectorstore(text_chunks):
32
+ model = "sentence-transformers/all-MiniLM-L6-v2"
33
  encode_kwargs = {
34
  "normalize_embeddings": True
35
  }
36
+ embeddings = HuggingFaceEmbeddings(
37
  model_name=model, encode_kwargs=encode_kwargs, model_kwargs={"device": "cpu"}
38
  )
39
  vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
 
70
  page_icon="πŸ“„",
71
  )
72
 
73
+ st.markdown("# ChatπŸ’¬ with multiple PDFs πŸ“„")
74
 
75
  st.write(css, unsafe_allow_html=True)
76
 
 
90
 
91
  with st.sidebar:
92
  st.subheader("Your documents")
93
+ st.text("You can upload multiple files at once")
94
  pdf_docs = st.file_uploader(
95
  "Upload your PDFs here and click on 'Process'", accept_multiple_files=True
96
  )