Spaces:
Sleeping
Sleeping
Stefano Fiorucci
commited on
Commit
•
2340dbd
1
Parent(s):
bf4f797
try to fix cache
Browse files
app.py
CHANGED
@@ -64,7 +64,7 @@ cache = Cache('./cache', size_limit=1*2**30)
|
|
64 |
# since our index is fixed and the following method is expensive,
|
65 |
# we decide to cache it
|
66 |
@cache.memoize()
|
67 |
-
def query(pipe, question, retriever_top_k=10, reader_top_k=5):
|
68 |
"""Run query and get answers"""
|
69 |
return (pipe.run(question,
|
70 |
params={"Retriever": {"top_k": retriever_top_k},
|
@@ -72,7 +72,8 @@ def query(pipe, question, retriever_top_k=10, reader_top_k=5):
|
|
72 |
|
73 |
|
74 |
def main():
|
75 |
-
|
|
|
76 |
|
77 |
pipe=start_haystack()
|
78 |
questions = load_questions()
|
|
|
64 |
# since our index is fixed and the following method is expensive,
|
65 |
# we decide to cache it
|
66 |
@cache.memoize()
|
67 |
+
def query(pipe, question, retriever_top_k=10, reader_top_k=5) -> dict:
|
68 |
"""Run query and get answers"""
|
69 |
return (pipe.run(question,
|
70 |
params={"Retriever": {"top_k": retriever_top_k},
|
|
|
72 |
|
73 |
|
74 |
def main():
|
75 |
+
# start a disk cache (1Gb)
|
76 |
+
cache = Cache('./cache', size_limit=1*2**30)
|
77 |
|
78 |
pipe=start_haystack()
|
79 |
questions = load_questions()
|