Update app.py
Browse files
app.py
CHANGED
@@ -185,7 +185,7 @@ def bm25_api(passages):
|
|
185 |
|
186 |
return bm25
|
187 |
|
188 |
-
bi_enc_options = ["multi-qa-mpnet-base-dot-v1","all-mpnet-base-v2","multi-qa-MiniLM-L6-cos-v1",'intfloat/e5-base',"neeva/query2query"]
|
189 |
|
190 |
def display_df_as_table(model,top_k,score='score'):
|
191 |
# Display the df with text and scores as a table
|
@@ -236,7 +236,7 @@ def search_func(query, bi_encoder_type, top_k=top_k):
|
|
236 |
bm25_df = display_df_as_table(bm25_hits,top_k)
|
237 |
st.write(bm25_df.to_html(index=False), unsafe_allow_html=True)
|
238 |
|
239 |
-
if bi_encoder_type == 'intfloat/e5-base':
|
240 |
query = 'query: ' + query
|
241 |
##### Sematic Search #####
|
242 |
# Encode the query using the bi-encoder and find potentially relevant passages
|
@@ -281,7 +281,7 @@ st.markdown("""There models available to choose from:""")
|
|
281 |
st.markdown(
|
282 |
"""
|
283 |
Model Source:
|
284 |
-
- Bi-Encoders - [multi-qa-mpnet-base-dot-v1](https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-dot-v1), [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2), [intfloat/e5-base](https://huggingface.co/intfloat/e5-base) and [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
|
285 |
- Cross-Encoder - [cross-encoder/ms-marco-MiniLM-L-12-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-12-v2)""")
|
286 |
|
287 |
st.markdown(
|
@@ -317,7 +317,7 @@ def clear_text():
|
|
317 |
def clear_search_text():
|
318 |
st.session_state["text_input"]= ""
|
319 |
|
320 |
-
url_text = st.text_input("Please Enter a url here",value="https://www.rba.gov.au/monetary-policy/rba-board-minutes/
|
321 |
|
322 |
st.markdown(
|
323 |
"<h3 style='text-align: center; color: red;'>OR</h3>",
|
|
|
185 |
|
186 |
return bm25
|
187 |
|
188 |
+
bi_enc_options = ["multi-qa-mpnet-base-dot-v1","all-mpnet-base-v2","multi-qa-MiniLM-L6-cos-v1",'intfloat/e5-base-v2',"neeva/query2query"]
|
189 |
|
190 |
def display_df_as_table(model,top_k,score='score'):
|
191 |
# Display the df with text and scores as a table
|
|
|
236 |
bm25_df = display_df_as_table(bm25_hits,top_k)
|
237 |
st.write(bm25_df.to_html(index=False), unsafe_allow_html=True)
|
238 |
|
239 |
+
if bi_encoder_type == 'intfloat/e5-base-v2':
|
240 |
query = 'query: ' + query
|
241 |
##### Sematic Search #####
|
242 |
# Encode the query using the bi-encoder and find potentially relevant passages
|
|
|
281 |
st.markdown(
|
282 |
"""
|
283 |
Model Source:
|
284 |
+
- Bi-Encoders - [multi-qa-mpnet-base-dot-v1](https://huggingface.co/sentence-transformers/multi-qa-mpnet-base-dot-v1), [all-mpnet-base-v2](https://huggingface.co/sentence-transformers/all-mpnet-base-v2), [intfloat/e5-base-v2](https://huggingface.co/intfloat/e5-base-v2) and [all-MiniLM-L6-v2](https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2)
|
285 |
- Cross-Encoder - [cross-encoder/ms-marco-MiniLM-L-12-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L-12-v2)""")
|
286 |
|
287 |
st.markdown(
|
|
|
317 |
def clear_search_text():
|
318 |
st.session_state["text_input"]= ""
|
319 |
|
320 |
+
url_text = st.text_input("Please Enter a url here",value="https://www.rba.gov.au/monetary-policy/rba-board-minutes/2023/2023-05-02.html",key='text_url',on_change=clear_search_text)
|
321 |
|
322 |
st.markdown(
|
323 |
"<h3 style='text-align: center; color: red;'>OR</h3>",
|