Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -123,7 +123,7 @@ def preprocess_plain_text(text,window_size=3):
|
|
123 |
|
124 |
return passages
|
125 |
|
126 |
-
@st.
|
127 |
def bi_encode(bi_enc,passages):
|
128 |
|
129 |
global bi_encoder
|
@@ -142,7 +142,7 @@ def bi_encode(bi_enc,passages):
|
|
142 |
|
143 |
return bi_encoder, corpus_embeddings
|
144 |
|
145 |
-
@st.
|
146 |
def cross_encode():
|
147 |
|
148 |
global cross_encoder
|
@@ -150,7 +150,7 @@ def cross_encode():
|
|
150 |
cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-12-v2')
|
151 |
return cross_encoder
|
152 |
|
153 |
-
@st.
|
154 |
def bm25_tokenizer(text):
|
155 |
|
156 |
# We also compare the results to lexical search (keyword search). Here, we use
|
@@ -164,7 +164,7 @@ def bm25_tokenizer(text):
|
|
164 |
tokenized_doc.append(token)
|
165 |
return tokenized_doc
|
166 |
|
167 |
-
@st.
|
168 |
def bm25_api(passages):
|
169 |
|
170 |
tokenized_corpus = []
|
|
|
123 |
|
124 |
return passages
|
125 |
|
126 |
+
@st.experimental_memo(allow_output_mutation=True,suppress_st_warning=True)
|
127 |
def bi_encode(bi_enc,passages):
|
128 |
|
129 |
global bi_encoder
|
|
|
142 |
|
143 |
return bi_encoder, corpus_embeddings
|
144 |
|
145 |
+
@st.experimental_singleton(allow_output_mutation=True)
|
146 |
def cross_encode():
|
147 |
|
148 |
global cross_encoder
|
|
|
150 |
cross_encoder = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-12-v2')
|
151 |
return cross_encoder
|
152 |
|
153 |
+
@st.experimental_memo(allow_output_mutation=True)
|
154 |
def bm25_tokenizer(text):
|
155 |
|
156 |
# We also compare the results to lexical search (keyword search). Here, we use
|
|
|
164 |
tokenized_doc.append(token)
|
165 |
return tokenized_doc
|
166 |
|
167 |
+
@st.experimental_singleton(allow_output_mutation=True)
|
168 |
def bm25_api(passages):
|
169 |
|
170 |
tokenized_corpus = []
|