sabatale commited on
Commit
1bb8b5f
·
verified ·
1 Parent(s): ba124e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -22,7 +22,7 @@ st.session_state["api_key_configured"] = True
22
  search_bar, button = st.columns(2)
23
  # Search bar
24
  with search_bar:
25
- username = st.text_input("Your question", on_change=reset_results)
26
 
27
  with button:
28
  st.write("")
@@ -31,19 +31,19 @@ with button:
31
 
32
  if st.session_state.get("api_key_configured"):
33
  run_query = (
34
- run_pressed or username != st.session_state.username
35
  )
36
 
37
  # Get results for query
38
- if run_query and username:
39
  reset_results()
40
- st.session_state.username = username
41
  with st.spinner("🔎"):
42
  try:
43
- st.session_state.result = query(username, pipeline)
44
  except JSONDecodeError as je:
45
  st.error(
46
- "👓    An error occurred reading the results. Is the document store working?"
47
  )
48
  except Exception as e:
49
  logging.exception(e)
 
22
  search_bar, button = st.columns(2)
23
  # Search bar
24
  with search_bar:
25
+ prompt = st.text_input("Your question", on_change=reset_results)
26
 
27
  with button:
28
  st.write("")
 
31
 
32
  if st.session_state.get("api_key_configured"):
33
  run_query = (
34
+ run_pressed
35
  )
36
 
37
  # Get results for query
38
+ if run_query and prompt:
39
  reset_results()
40
+ st.session_state.prompt = prompt
41
  with st.spinner("🔎"):
42
  try:
43
+ st.session_state.result = query(prompt, pipeline)
44
  except JSONDecodeError as je:
45
  st.error(
46
+ "🛑    Something went wrong! Database failure."
47
  )
48
  except Exception as e:
49
  logging.exception(e)