Stefano Fiorucci commited on
Commit
f0793eb
β€’
1 Parent(s): 567babf
Files changed (2) hide show
  1. app.py +4 -6
  2. data/questions.txt +6 -5
app.py CHANGED
@@ -47,7 +47,8 @@ def start_haystack():
47
  @st.cache()
48
  def load_questions():
49
  with open('./data/questions.txt') as fin:
50
- questions = [line.strip() for line in fin.readlines()]
 
51
  return questions
52
 
53
  def set_state_if_absent(key, value):
@@ -150,7 +151,7 @@ and see if the AI ​​can find an answer...
150
  question = st.text_input("",
151
  value=st.session_state.question,
152
  max_chars=100,
153
- #on_change=reset_results
154
  )
155
  col1, col2 = st.columns(2)
156
  col1.markdown("<style>.stButton button {width:100%;}</style>", unsafe_allow_html=True)
@@ -195,10 +196,7 @@ and see if the AI ​​can find an answer...
195
  return
196
  except Exception as e:
197
  logging.exception(e)
198
- if "The server is busy processing requests" in str(e) or "503" in str(e):
199
- st.error("πŸ§‘β€πŸŒΎ &nbsp;&nbsp; All our workers are busy! Try again later.")
200
- else:
201
- st.error("🐞 &nbsp;&nbsp; An error occurred during the request.")
202
  return
203
 
204
  if st.session_state.results:
47
  @st.cache()
48
  def load_questions():
49
  with open('./data/questions.txt') as fin:
50
+ questions = [line.strip() for line in fin.readlines()
51
+ if not line.startswith('#')]
52
  return questions
53
 
54
  def set_state_if_absent(key, value):
151
  question = st.text_input("",
152
  value=st.session_state.question,
153
  max_chars=100,
154
+ on_change=reset_results
155
  )
156
  col1, col2 = st.columns(2)
157
  col1.markdown("<style>.stButton button {width:100%;}</style>", unsafe_allow_html=True)
196
  return
197
  except Exception as e:
198
  logging.exception(e)
199
+ st.error("🐞 &nbsp;&nbsp; An error occurred during the request.")
 
 
 
200
  return
201
 
202
  if st.session_state.results:
data/questions.txt CHANGED
@@ -9,10 +9,11 @@ Who is Mrs Tremond
9
  Who is Ray Monroe?
10
  Where is Twin Peaks
11
  Who is the real owner of One Eyed Jack?
12
- Who works as a croupier?
13
- Why was Laura Palmer killed?
14
- Who is Evelyn Marsh?
15
  Who is the log lady?
16
- Who is Bobby Briggs' father?
17
  who is Susan Hurley
18
- Who is Mike
 
9
  Who is Ray Monroe?
10
  Where is Twin Peaks
11
  Who is the real owner of One Eyed Jack?
12
+ #Who works as a croupier?
13
+ #Why was Laura Palmer killed?
14
+ #Who is Evelyn Marsh?
15
  Who is the log lady?
16
+ #Who is Bobby Briggs' father?
17
  who is Susan Hurley
18
+ Who is Mike
19
+ Why did Windom Earle goes to Twin Peaks?