Spaces:
Running
Running
Stefano Fiorucci
commited on
try to better manage cache
Browse files
app_utils/backend_utils.py
CHANGED
|
@@ -18,7 +18,7 @@ from app_utils.config import (
|
|
| 18 |
)
|
| 19 |
|
| 20 |
|
| 21 |
-
@st.
|
| 22 |
def load_statements():
|
| 23 |
"""Load statements from file"""
|
| 24 |
with open(STATEMENTS_PATH) as fin:
|
|
@@ -66,7 +66,7 @@ pipe, prompt_node = start_haystack()
|
|
| 66 |
|
| 67 |
# the pipeline is not included as parameter of the following function,
|
| 68 |
# because it is difficult to cache
|
| 69 |
-
@st.
|
| 70 |
def check_statement(statement: str, retriever_top_k: int = 5):
|
| 71 |
"""Run query and verify statement"""
|
| 72 |
params = {"retriever": {"top_k": retriever_top_k}}
|
|
|
|
| 18 |
)
|
| 19 |
|
| 20 |
|
| 21 |
+
@st.cache()
|
| 22 |
def load_statements():
|
| 23 |
"""Load statements from file"""
|
| 24 |
with open(STATEMENTS_PATH) as fin:
|
|
|
|
| 66 |
|
| 67 |
# the pipeline is not included as parameter of the following function,
|
| 68 |
# because it is difficult to cache
|
| 69 |
+
@st.cache(allow_output_mutation=True, ttl=36000)
|
| 70 |
def check_statement(statement: str, retriever_top_k: int = 5):
|
| 71 |
"""Run query and verify statement"""
|
| 72 |
params = {"retriever": {"top_k": retriever_top_k}}
|