improve caching and disable loading spinners for cached functions
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ from langchain import OpenAI
|
|
12 |
from langchain import PromptTemplate
|
13 |
|
14 |
|
15 |
-
@st.
|
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.
|
47 |
def load_chain():
|
48 |
|
49 |
BOOK_NAME = "1984"
|
@@ -122,6 +122,10 @@ def get_text():
|
|
122 |
return user_input
|
123 |
|
124 |
user_input = get_text()
|
|
|
|
|
|
|
|
|
125 |
ask = st.button("Ask")
|
126 |
|
127 |
if ask:
|
|
|
12 |
from langchain import PromptTemplate
|
13 |
|
14 |
|
15 |
+
@st.experimental_singleton(show_spinner=False)
|
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_singleton(show_spinner=False)
|
47 |
def load_chain():
|
48 |
|
49 |
BOOK_NAME = "1984"
|
|
|
122 |
return user_input
|
123 |
|
124 |
user_input = get_text()
|
125 |
+
|
126 |
+
# show question
|
127 |
+
st.text(f"**You: {user_input}**")
|
128 |
+
|
129 |
ask = st.button("Ask")
|
130 |
|
131 |
if ask:
|