Stefano Fiorucci commited on
Commit
6e587e4
1 Parent(s): b5d59e3

bug fix cache

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -20,7 +20,7 @@ from urllib.parse import unquote
20
 
21
  # FAISS index directory
22
  INDEX_DIR = 'data/index'
23
- pipe=None
24
 
25
  # the following function is cached to make index and models load only at start
26
  @st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None}, allow_output_mutation=True)
@@ -55,6 +55,8 @@ def set_state_if_absent(key, value):
55
  if key not in st.session_state:
56
  st.session_state[key] = value
57
 
 
 
58
  # hash_funcs={builtins.weakref: my_hash_func}
59
  @st.cache(persist=True, allow_output_mutation=True)
60
  def query(question: str, retriever_top_k:int=10, reader_top_k:int=5):
@@ -67,7 +69,7 @@ def query(question: str, retriever_top_k:int=10, reader_top_k:int=5):
67
 
68
  def main():
69
 
70
- pipe=start_haystack()
71
  questions = load_questions()
72
 
73
  # Persistent state
 
20
 
21
  # FAISS index directory
22
  INDEX_DIR = 'data/index'
23
+ # pipe=None
24
 
25
  # the following function is cached to make index and models load only at start
26
  @st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None}, allow_output_mutation=True)
 
55
  if key not in st.session_state:
56
  st.session_state[key] = value
57
 
58
+ pipe=start_haystack()
59
+
60
  # hash_funcs={builtins.weakref: my_hash_func}
61
  @st.cache(persist=True, allow_output_mutation=True)
62
  def query(question: str, retriever_top_k:int=10, reader_top_k:int=5):
 
69
 
70
  def main():
71
 
72
+
73
  questions = load_questions()
74
 
75
  # Persistent state