tony346 commited on
Commit
f81421e
1 Parent(s): 5fbbeb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -43,9 +43,9 @@ def get_text_chunks(text):
43
 
44
  def get_vectorstore(text_chunks):
45
  # Load the desired embeddings model.
46
- embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L12-v2',
47
  model_kwargs={'device': 'cpu'})
48
- # embeddings = OpenAIEmbeddings()
49
  # embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
50
  # vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
51
  vectorstore = Chroma.from_texts(texts=text_chunks, embedding=embeddings)
@@ -102,8 +102,8 @@ def get_csv_file(docs):
102
  def get_json_file(docs):
103
  import json
104
  text = ''
105
- with open(docs, 'r') as f:
106
- json_data = json.load(f)
107
 
108
  for f_key, f_value in json_data.items():
109
  for s_value in f_value:
@@ -140,7 +140,7 @@ def main():
140
  docs = st.file_uploader(
141
  "Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
142
  if st.button("Process"):
143
- with st.spinner("Processing"):
144
  # get pdf text
145
  raw_text = ""
146
 
 
43
 
44
  def get_vectorstore(text_chunks):
45
  # Load the desired embeddings model.
46
+ embeddings = HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L6-v2',
47
  model_kwargs={'device': 'cpu'})
48
+ # embeddings = OpenAIEmbeddings()sentence-transformers/all-MiniLM-L6-v2
49
  # embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-xl")
50
  # vectorstore = FAISS.from_texts(texts=text_chunks, embedding=embeddings)
51
  vectorstore = Chroma.from_texts(texts=text_chunks, embedding=embeddings)
 
102
  def get_json_file(docs):
103
  import json
104
  text = ''
105
+ # with open(docs, 'r') as f:
106
+ json_data = json.load(docs)
107
 
108
  for f_key, f_value in json_data.items():
109
  for s_value in f_value:
 
140
  docs = st.file_uploader(
141
  "Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
142
  if st.button("Process"):
143
+ with st.spinner("Processing"):f
144
  # get pdf text
145
  raw_text = ""
146