peter2000 commited on
Commit
4bd6367
1 Parent(s): e21ac83

Update appStore/keyword_search.py

Browse files
Files changed (1) hide show
  1. appStore/keyword_search.py +11 -13
appStore/keyword_search.py CHANGED
@@ -20,7 +20,8 @@ import string
20
  from tqdm.autonotebook import tqdm
21
  import numpy as np
22
  import tempfile
23
-
 
24
 
25
  #Haystack Components
26
  @st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None},allow_output_mutation=True)
@@ -104,15 +105,9 @@ def app():
104
  try:
105
  msg = 'Asked ' + question
106
  logging.info(msg)
107
- st.session_state.results = ask_question(question)
108
- except Exception as e:
109
- logging.exception(e)
110
-
111
-
112
-
113
- if st.session_state.results:
114
- st.write('## Top Results')
115
- for count, result in enumerate(st.session_state.results):
116
  if result["answer"]:
117
  answer, context = result["answer"], result["context"]
118
  start_idx = context.find(answer)
@@ -126,6 +121,9 @@ def app():
126
  st.info(
127
  "🤔    Haystack is unsure whether any of the documents contain an answer to your question. Try to reformulate it!"
128
  )
129
-
130
-
131
-
 
 
 
 
20
  from tqdm.autonotebook import tqdm
21
  import numpy as np
22
  import tempfile
23
+ import logging
24
+ logger = logging.getLogger(__name__)
25
 
26
  #Haystack Components
27
  @st.cache(hash_funcs={"builtins.SwigPyObject": lambda _: None},allow_output_mutation=True)
 
105
  try:
106
  msg = 'Asked ' + question
107
  logging.info(msg)
108
+ results = ask_question(question)
109
+ st.write('## Top Results')
110
+ for count, result in enumerate(results):
 
 
 
 
 
 
111
  if result["answer"]:
112
  answer, context = result["answer"], result["context"]
113
  start_idx = context.find(answer)
 
121
  st.info(
122
  "🤔    Haystack is unsure whether any of the documents contain an answer to your question. Try to reformulate it!"
123
  )
124
+
125
+ except Exception as e:
126
+ logging.exception(e)
127
+
128
+
129
+