MaxGit32 commited on
Commit
7446d35
1 Parent(s): e1a48ee

Update pages/bot.py

Browse files
Files changed (1) hide show
  1. pages/bot.py +6 -5
pages/bot.py CHANGED
@@ -49,7 +49,10 @@ def get_text_chunks(text):
49
  return chunks
50
 
51
  # nur zum Anlegen des lokalen Verzeichnisses "Store" und speichern der Vektor-Datenbank
52
- def create_vectorstore_and_store(text_chunks):
 
 
 
53
  embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
54
  # Initiate Faiss DB
55
  vectorstoreDB = FAISS.from_texts(texts=text_chunks,embedding=embeddings)#texts=text_chunks,
@@ -72,10 +75,8 @@ def get_vectorstore():
72
 
73
  def main():
74
  user_question = st.text_area("Stell mir eine Frage2: ")
75
- folder_path = './files'
76
- pdf_text = get_pdf_text(folder_path)
77
- text_chunks = get_text_chunks(pdf_text)
78
- create_vectorstore_and_store(text_chunks)
79
 
80
  retriever=get_vectorstore().as_retriever()
81
  retrieved_docs=retriever.invoke(
 
49
  return chunks
50
 
51
  # nur zum Anlegen des lokalen Verzeichnisses "Store" und speichern der Vektor-Datenbank
52
+ def create_vectorstore_and_store():
53
+ folder_path = './files'
54
+ pdf_text = get_pdf_text(folder_path)
55
+ text_chunks = get_text_chunks(pdf_text)
56
  embeddings = HuggingFaceInstructEmbeddings(model_name="hkunlp/instructor-base")
57
  # Initiate Faiss DB
58
  vectorstoreDB = FAISS.from_texts(texts=text_chunks,embedding=embeddings)#texts=text_chunks,
 
75
 
76
  def main():
77
  user_question = st.text_area("Stell mir eine Frage2: ")
78
+
79
+ create_vectorstore_and_store()
 
 
80
 
81
  retriever=get_vectorstore().as_retriever()
82
  retrieved_docs=retriever.invoke(