Anne31415 commited on
Commit
d1a1a0f
·
verified ·
1 Parent(s): b7092f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -71,7 +71,7 @@ api_key = os.getenv("OPENAI_API_KEY")
71
 
72
 
73
  @st.cache_resource
74
- def load_vector_store(file_path, store_name, force_reload=True):
75
  local_repo_path = "Private_Book"
76
  vector_store_path = os.path.join(local_repo_path, f"{store_name}.pkl")
77
 
@@ -125,7 +125,7 @@ def load_pdf_text(file_path):
125
 
126
  def load_chatbot():
127
  #return load_qa_chain(llm=OpenAI(), chain_type="stuff")
128
- return load_qa_chain(llm=OpenAI(model_name="gpt-4-0125-preview"), chain_type="stuff")
129
 
130
 
131
  def display_chat_history(chat_history):
@@ -262,7 +262,7 @@ def page1():
262
  st.error("File not found. Please check the file path.")
263
  return
264
 
265
- VectorStore = load_vector_store(pdf_path, "KH_Reform_2301", force_reload=True)
266
 
267
  display_chat_history(st.session_state['chat_history_page1'])
268
 
@@ -381,7 +381,7 @@ def page2():
381
  st.error("File not found. Please check the file path.")
382
  return
383
 
384
- VectorStore = load_vector_store(pdf_path2, "Buch_2301", force_reload=True)
385
 
386
 
387
 
@@ -504,7 +504,7 @@ def page3():
504
  st.error("File not found. Please check the file path.")
505
  return
506
 
507
- VectorStore = load_vector_store(pdf_path3, "Kosten_Str_2301", force_reload=True)
508
 
509
 
510
 
 
71
 
72
 
73
  @st.cache_resource
74
+ def load_vector_store(file_path, store_name, force_reload=False):
75
  local_repo_path = "Private_Book"
76
  vector_store_path = os.path.join(local_repo_path, f"{store_name}.pkl")
77
 
 
125
 
126
  def load_chatbot():
127
  #return load_qa_chain(llm=OpenAI(), chain_type="stuff")
128
+ return load_qa_chain(llm=OpenAI(model_name="gpt-3.5-turbo-instruct"), chain_type="stuff")
129
 
130
 
131
  def display_chat_history(chat_history):
 
262
  st.error("File not found. Please check the file path.")
263
  return
264
 
265
+ VectorStore = load_vector_store(pdf_path, "KH_Reform_2301", force_reload=False)
266
 
267
  display_chat_history(st.session_state['chat_history_page1'])
268
 
 
381
  st.error("File not found. Please check the file path.")
382
  return
383
 
384
+ VectorStore = load_vector_store(pdf_path2, "Buch_2301", force_reload=False)
385
 
386
 
387
 
 
504
  st.error("File not found. Please check the file path.")
505
  return
506
 
507
+ VectorStore = load_vector_store(pdf_path3, "Kosten_Str_2301", force_reload=False)
508
 
509
 
510