github-actions commited on
Commit
4b73929
1 Parent(s): 0a5fe3b

Sync updates from source repository

Browse files
Files changed (1) hide show
  1. app.py +10 -11
app.py CHANGED
@@ -3,6 +3,8 @@ from query import VectaraQuery
3
  import os
4
 
5
  import streamlit as st
 
 
6
  from PIL import Image
7
 
8
  max_examples = 4
@@ -21,18 +23,15 @@ def launch_bot():
21
  response = vq.submit_query_streaming(question)
22
  return response
23
 
24
- def show_example_questions():
25
- if len(st.session_state.example_messages) > 0 and st.session_state.first_turn:
26
- st.markdown("<h6>Queries To Try:</h6>", unsafe_allow_html=True)
27
- ex_cols = st.columns(max_examples)
28
- for i, example in enumerate(st.session_state.example_messages):
29
- with ex_cols[i]:
30
- if st.button(example, key=f"example_{i}"):
31
- st.session_state.ex_prompt = example
32
- st.session_state.first_turn = False
33
- return True
34
  return False
35
-
36
  if 'cfg' not in st.session_state:
37
  corpus_ids = str(os.environ['corpus_ids']).split(',')
38
  cfg = OmegaConf.create({
 
3
  import os
4
 
5
  import streamlit as st
6
+ from streamlit_pills import pills
7
+
8
  from PIL import Image
9
 
10
  max_examples = 4
 
23
  response = vq.submit_query_streaming(question)
24
  return response
25
 
26
+ def show_example_questions():
27
+ if len(st.session_state.example_messages) > 0 and st.session_state.first_turn:
28
+ selected_example = pills("Queries to Try:", st.session_state.example_messages, index=None)
29
+ if selected_example:
30
+ st.session_state.ex_prompt = selected_example
31
+ st.session_state.first_turn = False
32
+ return True
 
 
 
33
  return False
34
+
35
  if 'cfg' not in st.session_state:
36
  corpus_ids = str(os.environ['corpus_ids']).split(',')
37
  cfg = OmegaConf.create({