calmgoose commited on
Commit
7e76253
Β·
1 Parent(s): 2732cd9

@st .cache_data doesn't work because hugging face uses an older streamlit version

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -12,7 +12,7 @@ from langchain import OpenAI
12
  from langchain import PromptTemplate
13
 
14
 
15
- @st.cache_data
16
  def load_vectorstore():
17
  # download from hugging face
18
  snapshot_download(repo_id="calmgoose/orwell-1984_faiss-instructembeddings",
@@ -43,7 +43,7 @@ def load_vectorstore():
43
 
44
  return docsearch
45
 
46
- @st.cache_data
47
  def load_chain():
48
 
49
  BOOK_NAME = "1984"
@@ -96,8 +96,6 @@ def get_answer(question):
96
  return result["result"] + "\n\n" + "From pages: " + sources_string
97
 
98
 
99
- # chain = load_chain()
100
-
101
  # From here down is all the StreamLit UI.
102
  st.set_page_config(page_title="Talk2Book: 1984", page_icon="πŸ“–")
103
  st.title("Talk2Book: 1984")
 
12
  from langchain import PromptTemplate
13
 
14
 
15
+ @st.experimental_memo
16
  def load_vectorstore():
17
  # download from hugging face
18
  snapshot_download(repo_id="calmgoose/orwell-1984_faiss-instructembeddings",
 
43
 
44
  return docsearch
45
 
46
+ @st.experimental_memo
47
  def load_chain():
48
 
49
  BOOK_NAME = "1984"
 
96
  return result["result"] + "\n\n" + "From pages: " + sources_string
97
 
98
 
 
 
99
  # From here down is all the StreamLit UI.
100
  st.set_page_config(page_title="Talk2Book: 1984", page_icon="πŸ“–")
101
  st.title("Talk2Book: 1984")