hitz02 commited on
Commit
2c34ee1
·
1 Parent(s): a25958d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import pandas as pd
2
  import numpy as np
 
3
  import pickle
4
  import glob
5
  import json
@@ -88,18 +89,24 @@ def main():
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:
 
1
  import pandas as pd
2
  import numpy as np
3
+ import datetime, time
4
  import pickle
5
  import glob
6
  import json
 
89
  query = st.text_input("Enter Query",'What are the corona viruses?', key="query")
90
 
91
  with st.spinner('Please wait...'):
92
+ dt1 = datetime.datetime.now()
93
+
94
  query_embedding, results1 = fetch_stage1(query, model, list_of_articles)
95
  results2 = fetch_stage2(results1, model, embeddings, query_embedding)
96
  results3 = fetch_stage3(results2, query, embeddings, comprehension_model, spacy_nlp)
97
+
98
+ dt2 = datetime.datetime.now()
99
+ tdelta = dt2-dt1
100
+
101
+ st.write('Time taken in minutes: %.2f' % tdelta.seconds/60)
102
+
103
  if results3:
104
  count = 1
105
 
106
  for res in results3:
107
  st.write('{}> {}'.format(count, res[2]))
108
  st.write('Score: %.4f' % (res[1]))
109
+ st.write("From the article with title:\n{}".format(embeddings[res[0]][0]))
110
  st.write("\n")
111
 
112
  if count > 3: