ErikH commited on
Commit
f5dd29d
1 Parent(s): 6f26751

Update pages/bot.py

Browse files
Files changed (1) hide show
  1. pages/bot.py +4 -2
pages/bot.py CHANGED
@@ -19,6 +19,8 @@ from langchain.llms import HuggingFaceHub
19
  #pip install InstructorEmbedding
20
  ###############
21
 
 
 
22
  # PDF in String umwandeln
23
  def get_pdf_text(folder_path):
24
  text = ""
@@ -49,7 +51,7 @@ def get_text_chunks(text):
49
 
50
  # nur zum Anlegen des lokalen Verzeichnisses "Store" und speichern der Vektor-Datenbank
51
  def create_vectorstore_and_store(text_chunks):
52
- embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
53
  # Initiate Faiss DB
54
  vectorstoreDB = FAISS.from_texts(texts=text_chunks,embedding=embeddings)#texts=text_chunks,
55
  ###
@@ -65,7 +67,7 @@ def create_vectorstore_and_store(text_chunks):
65
  ########
66
 
67
  def get_vectorstore():
68
- embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
69
  #Abruf lokaler Vektordatenbank
70
  save_directory = "Store"
71
  vectorstoreDB = FAISS.load_local(save_directory, embeddings)
 
19
  #pip install InstructorEmbedding
20
  ###############
21
 
22
+ os.environ['SENTENCE_TRANSFORMERS_HOME'] = './.cache'
23
+
24
  # PDF in String umwandeln
25
  def get_pdf_text(folder_path):
26
  text = ""
 
51
 
52
  # nur zum Anlegen des lokalen Verzeichnisses "Store" und speichern der Vektor-Datenbank
53
  def create_vectorstore_and_store(text_chunks):
54
+ embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base", cache_folder = "./.cache")
55
  # Initiate Faiss DB
56
  vectorstoreDB = FAISS.from_texts(texts=text_chunks,embedding=embeddings)#texts=text_chunks,
57
  ###
 
67
  ########
68
 
69
  def get_vectorstore():
70
+ embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base", cache_folder = "./.cache")
71
  #Abruf lokaler Vektordatenbank
72
  save_directory = "Store"
73
  vectorstoreDB = FAISS.load_local(save_directory, embeddings)