Update app.py
Browse files
app.py
CHANGED
@@ -85,35 +85,30 @@ def main():
|
|
85 |
|
86 |
comprehension_model = load_comprehension_model()
|
87 |
|
88 |
-
query = st.text_input("Enter Query",'
|
89 |
|
90 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
st.write('{}> {}'.format(count, res[2]))
|
106 |
-
st.write('Score: %.4f' % (res[1]))
|
107 |
-
st.write("From the article with title: {}".format(embeddings[res[0]][0]))
|
108 |
-
st.write("\n")
|
109 |
-
# print(count,". ", res[2], "(Score: %.4f)" % (res[1]))
|
110 |
-
# print("From the article with title: ", embeddings[res[0]][0])
|
111 |
-
# print("\n")
|
112 |
-
if count > 3:
|
113 |
-
break
|
114 |
-
count += 1
|
115 |
-
else:
|
116 |
-
st.info("There isn't any answer")
|
117 |
|
118 |
|
119 |
if __name__ == '__main__':
|
|
|
85 |
|
86 |
comprehension_model = load_comprehension_model()
|
87 |
|
88 |
+
query = st.text_input("Enter Query",'What are the corona viruses?', key="query")
|
89 |
|
90 |
+
with st.spinner('Please wait...'):
|
91 |
+
|
92 |
+
query_embedding, results1 = fetch_stage1(query, model, list_of_articles)
|
93 |
+
results2 = fetch_stage2(results1, model, embeddings, query_embedding)
|
94 |
+
results3 = fetch_stage3(results2, query, embeddings, comprehension_model, spacy_nlp)
|
95 |
+
|
96 |
+
if results3:
|
97 |
+
count = 1
|
98 |
|
99 |
+
for res in results3:
|
100 |
+
st.write('{}> {}'.format(count, res[2]))
|
101 |
+
st.write('Score: %.4f' % (res[1]))
|
102 |
+
st.write("From the article with title: {}".format(embeddings[res[0]][0]))
|
103 |
+
st.write("\n")
|
104 |
+
|
105 |
+
if count > 3:
|
106 |
+
break
|
107 |
+
count += 1
|
108 |
+
else:
|
109 |
+
st.info("There isn't any answer")
|
110 |
+
|
111 |
+
st.success('Done!')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
|
113 |
|
114 |
if __name__ == '__main__':
|