Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,14 +14,14 @@ import pickle
|
|
14 |
## Main page
|
15 |
############
|
16 |
|
17 |
-
st.write("#
|
18 |
|
19 |
st.markdown("***Idea is to build a model which will take query as inputs and generate expansion information as outputs.***")
|
20 |
image = Image.open('top.png')
|
21 |
st.image(image)
|
22 |
|
23 |
-
|
24 |
-
|
25 |
#user_query = st_tags(
|
26 |
# label='# Enter Query:',
|
27 |
# text='Press enter to add more',
|
@@ -83,21 +83,21 @@ def search(query):
|
|
83 |
for idx in range(len(cross_scores)):
|
84 |
hits[idx]['cross-score'] = cross_scores[idx]
|
85 |
|
86 |
-
# Output of top-
|
87 |
st.write("\n-------------------------\n")
|
88 |
-
st.write("Top-
|
89 |
hits = sorted(hits, key=lambda x: x['score'], reverse=True)
|
90 |
-
for hit in hits[0:
|
91 |
st.write("\t{:.3f}\t{}".format(hit['score'], passages[hit['corpus_id']].replace("\n", " ")))
|
92 |
|
93 |
-
# Output of top-
|
94 |
st.write("\n-------------------------\n")
|
95 |
-
st.write("Top-
|
96 |
hits = sorted(hits, key=lambda x: x['cross-score'], reverse=True)
|
97 |
-
for hit in hits[0:
|
98 |
st.write("\t{:.3f}\t{}".format(hit['cross-score'], passages[hit['corpus_id']].replace("\n", " ")))
|
99 |
|
100 |
st.write("## Results:")
|
101 |
-
if st.button('
|
102 |
out = search(query = user_query)
|
103 |
-
|
|
|
14 |
## Main page
|
15 |
############
|
16 |
|
17 |
+
st.write("# Demonstration for Etsy Query Expansion(Etsy-QE)")
|
18 |
|
19 |
st.markdown("***Idea is to build a model which will take query as inputs and generate expansion information as outputs.***")
|
20 |
image = Image.open('top.png')
|
21 |
st.image(image)
|
22 |
|
23 |
+
st.sidebar.write("# Top-N Selection")
|
24 |
+
maxtags_sidebar = st.sidebar.slider('Number of query allowed?', 1, 20, 1, key='ehikwegrjifbwreuk')
|
25 |
#user_query = st_tags(
|
26 |
# label='# Enter Query:',
|
27 |
# text='Press enter to add more',
|
|
|
83 |
for idx in range(len(cross_scores)):
|
84 |
hits[idx]['cross-score'] = cross_scores[idx]
|
85 |
|
86 |
+
# Output of top-N hits from bi-encoder
|
87 |
st.write("\n-------------------------\n")
|
88 |
+
st.write("Top-N Bi-Encoder Retrieval hits")
|
89 |
hits = sorted(hits, key=lambda x: x['score'], reverse=True)
|
90 |
+
for hit in hits[0:maxtags_sidebar]:
|
91 |
st.write("\t{:.3f}\t{}".format(hit['score'], passages[hit['corpus_id']].replace("\n", " ")))
|
92 |
|
93 |
+
# Output of top-N hits from re-ranker
|
94 |
st.write("\n-------------------------\n")
|
95 |
+
st.write("Top-N Cross-Encoder Re-ranker hits")
|
96 |
hits = sorted(hits, key=lambda x: x['cross-score'], reverse=True)
|
97 |
+
for hit in hits[0:maxtags_sidebar]:
|
98 |
st.write("\t{:.3f}\t{}".format(hit['cross-score'], passages[hit['corpus_id']].replace("\n", " ")))
|
99 |
|
100 |
st.write("## Results:")
|
101 |
+
if st.button('Generated Expansion'):
|
102 |
out = search(query = user_query)
|
103 |
+
st.success(out)
|