achapman commited on
Commit
2ba232c
·
1 Parent(s): 67d9a0f

fix a bug

Browse files
Files changed (1) hide show
  1. app.py +11 -12
app.py CHANGED
@@ -26,18 +26,6 @@ HF_TOKEN = os.environ["HF_TOKEN"]
26
 
27
  # ---- GLOBAL DECLARATIONS ---- #
28
 
29
-
30
- # Load vectorstore (prepopulated with a notebook, because it takes forever)
31
- print("loading vectorstore")
32
- if os.path.exists("./data/vectorstore"):
33
- vectorstore = FAISS.load_local(
34
- "./data/vectorstore",
35
- hf_embeddings,
36
- allow_dangerous_deserialization=True # this is necessary to load the vectorstore from disk as it's stored as a `.pkl` file.
37
- )
38
- hf_retriever = vectorstore.as_retriever()
39
- print("Loaded Vectorstore")
40
-
41
  # -- AUGMENTED -- #
42
  ### 1. DEFINE STRING TEMPLATE
43
  RAG_PROMPT_TEMPLATE = """\
@@ -92,6 +80,17 @@ async def start_chat():
92
  )
93
  print("embeddings initialized")
94
 
 
 
 
 
 
 
 
 
 
 
 
95
  print("initializing huggingface endpoint")
96
  hf_llm = HuggingFaceEndpoint(
97
  endpoint_url=f"{HF_LLM_ENDPOINT}",
 
26
 
27
  # ---- GLOBAL DECLARATIONS ---- #
28
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  # -- AUGMENTED -- #
30
  ### 1. DEFINE STRING TEMPLATE
31
  RAG_PROMPT_TEMPLATE = """\
 
80
  )
81
  print("embeddings initialized")
82
 
83
+ # Load vectorstore (prepopulated with a notebook, because it takes forever)
84
+ print("loading vectorstore")
85
+ if os.path.exists("./data/vectorstore"):
86
+ vectorstore = FAISS.load_local(
87
+ "./data/vectorstore",
88
+ hf_embeddings,
89
+ allow_dangerous_deserialization=True # this is necessary to load the vectorstore from disk as it's stored as a `.pkl` file.
90
+ )
91
+ hf_retriever = vectorstore.as_retriever()
92
+ print("Loaded Vectorstore")
93
+
94
  print("initializing huggingface endpoint")
95
  hf_llm = HuggingFaceEndpoint(
96
  endpoint_url=f"{HF_LLM_ENDPOINT}",