Spaces:
Running
Running
minor updates
Browse files
app.py
CHANGED
|
@@ -4,11 +4,6 @@ from query import VectaraQuery
|
|
| 4 |
import streamlit as st
|
| 5 |
import os
|
| 6 |
|
| 7 |
-
def isTrue(x) -> bool:
|
| 8 |
-
if isinstance(x, bool):
|
| 9 |
-
return x
|
| 10 |
-
return x.strip().lower() == 'true'
|
| 11 |
-
|
| 12 |
def launch_bot():
|
| 13 |
def generate_response(question, role, topic):
|
| 14 |
response = vq.submit_query(question, role, topic)
|
|
@@ -20,7 +15,7 @@ def launch_bot():
|
|
| 20 |
'corpus_id': str(os.environ['VECTARA_CORPUS_ID']),
|
| 21 |
'api_key': str(os.environ['VECTARA_API_KEY']),
|
| 22 |
'prompt_name': 'vectara-experimental-summary-ext-2023-12-11-large',
|
| 23 |
-
'topic': '
|
| 24 |
'human_role': 'in opposition to',
|
| 25 |
'bot_role': 'in support of'
|
| 26 |
})
|
|
@@ -34,9 +29,13 @@ def launch_bot():
|
|
| 34 |
|
| 35 |
# left side content
|
| 36 |
with st.sidebar:
|
| 37 |
-
st.markdown(f"## Welcome to Debate Bot.\n\n\n"
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
| 39 |
|
|
|
|
| 40 |
st.markdown("---")
|
| 41 |
st.markdown(
|
| 42 |
"## How this works?\n"
|
|
@@ -45,7 +44,7 @@ def launch_bot():
|
|
| 45 |
st.markdown("---")
|
| 46 |
|
| 47 |
if "messages" not in st.session_state.keys():
|
| 48 |
-
st.session_state.messages = [{"role": "assistant", "content": f"Please make your
|
| 49 |
|
| 50 |
# Display chat messages
|
| 51 |
for message in st.session_state.messages:
|
|
|
|
| 4 |
import streamlit as st
|
| 5 |
import os
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def launch_bot():
|
| 8 |
def generate_response(question, role, topic):
|
| 9 |
response = vq.submit_query(question, role, topic)
|
|
|
|
| 15 |
'corpus_id': str(os.environ['VECTARA_CORPUS_ID']),
|
| 16 |
'api_key': str(os.environ['VECTARA_API_KEY']),
|
| 17 |
'prompt_name': 'vectara-experimental-summary-ext-2023-12-11-large',
|
| 18 |
+
'topic': 'Standardized testing in education',
|
| 19 |
'human_role': 'in opposition to',
|
| 20 |
'bot_role': 'in support of'
|
| 21 |
})
|
|
|
|
| 29 |
|
| 30 |
# left side content
|
| 31 |
with st.sidebar:
|
| 32 |
+
st.markdown(f"## Welcome to Debate Bot.\n\n\n")
|
| 33 |
+
|
| 34 |
+
role_options = ['in opposition to', 'in support of']
|
| 35 |
+
cfg.human_role = st.selectbox('Your are:', role_options)
|
| 36 |
+
cfg.bot_role = role_options[1] if cfg.human_role == role_options[0] else role_options[0]
|
| 37 |
|
| 38 |
+
st.markdown(f"{cfg.topic}.\n\n")
|
| 39 |
st.markdown("---")
|
| 40 |
st.markdown(
|
| 41 |
"## How this works?\n"
|
|
|
|
| 44 |
st.markdown("---")
|
| 45 |
|
| 46 |
if "messages" not in st.session_state.keys():
|
| 47 |
+
st.session_state.messages = [{"role": "assistant", "content": f"Please make your opening statment."}]
|
| 48 |
|
| 49 |
# Display chat messages
|
| 50 |
for message in st.session_state.messages:
|