Update app.py
Browse files
app.py
CHANGED
|
@@ -39,32 +39,29 @@ def format_elapsed_time(time):
|
|
| 39 |
return "{:.2f}".format(time)
|
| 40 |
|
| 41 |
# Layout with three columns
|
| 42 |
-
col1, col2, col3 = st.columns([1, 3, 1]) # Adjusted width ratios for better centering
|
| 43 |
|
| 44 |
# Left Column: Variables and Settings
|
| 45 |
with col1:
|
| 46 |
st.sidebar.image('cognizant_logo.jpg')
|
| 47 |
-
st.sidebar.header("
|
| 48 |
-
st.sidebar.subheader("
|
| 49 |
numberOfQuestions = st.sidebar.slider("Number of Questions", 0, 10, 5, 1)
|
| 50 |
-
persona1SystemMessage = st.sidebar.text_area("Define
|
| 51 |
llm1 = st.sidebar.selectbox("Model Selection", ['GPT-4', 'GPT3.5'])
|
| 52 |
temp1 = st.sidebar.slider("Temperature", 0.0, 1.0, 0.6, 0.1)
|
| 53 |
tokens1 = st.sidebar.slider("Tokens", 0, 4000, 500, 100)
|
| 54 |
-
|
| 55 |
-
llm2 = st.sidebar.selectbox("Model Selection", ['GPT-4', 'GPT3.5'], key="persona2")
|
| 56 |
-
temp2 = st.sidebar.slider("Temperature", 0.0, 1.0, 0.5, 0.1, key="temp2")
|
| 57 |
-
tokens2 = st.sidebar.slider("Tokens", 0, 4000, 500, 100, key="tokens2")
|
| 58 |
|
| 59 |
# Middle Column: Chat Interface
|
| 60 |
with col2:
|
| 61 |
-
st.markdown("<div style='text-align: center;'><h1>
|
| 62 |
|
| 63 |
# User ID Input
|
| 64 |
user_id = st.text_input("User ID:", key="user_id")
|
| 65 |
|
| 66 |
if not user_id:
|
| 67 |
-
st.warning("Please provide
|
| 68 |
else:
|
| 69 |
# Initialize chat history
|
| 70 |
if "messages" not in st.session_state:
|
|
@@ -78,7 +75,7 @@ with col2:
|
|
| 78 |
st.markdown(message["content"])
|
| 79 |
|
| 80 |
# Chat input at the bottom
|
| 81 |
-
if user_input := st.chat_input("
|
| 82 |
# Add user message
|
| 83 |
st.session_state.messages.append({"role": "user", "content": user_input})
|
| 84 |
st.chat_message("user").markdown(user_input)
|
|
@@ -92,11 +89,11 @@ with col2:
|
|
| 92 |
persona2SystemMessage=persona2SystemMessage,
|
| 93 |
llm1=llm1,
|
| 94 |
tokens1=tokens1,
|
| 95 |
-
temperature1=
|
| 96 |
userMessage2="",
|
| 97 |
-
llm2=
|
| 98 |
-
tokens2=
|
| 99 |
-
temperature2=
|
| 100 |
)
|
| 101 |
|
| 102 |
# Call the API
|
|
|
|
| 39 |
return "{:.2f}".format(time)
|
| 40 |
|
| 41 |
# Layout with three columns
|
| 42 |
+
col1, col2, col3 = st.columns([1, 3, 1], gap="small") # Adjusted width ratios for better centering
|
| 43 |
|
| 44 |
# Left Column: Variables and Settings
|
| 45 |
with col1:
|
| 46 |
st.sidebar.image('cognizant_logo.jpg')
|
| 47 |
+
st.sidebar.header("RAG Query Designer")
|
| 48 |
+
st.sidebar.subheader("Query Translation Prompt")
|
| 49 |
numberOfQuestions = st.sidebar.slider("Number of Questions", 0, 10, 5, 1)
|
| 50 |
+
persona1SystemMessage = st.sidebar.text_area("Define Query Translation Prompt", value=placeHolderPersona1, height=300)
|
| 51 |
llm1 = st.sidebar.selectbox("Model Selection", ['GPT-4', 'GPT3.5'])
|
| 52 |
temp1 = st.sidebar.slider("Temperature", 0.0, 1.0, 0.6, 0.1)
|
| 53 |
tokens1 = st.sidebar.slider("Tokens", 0, 4000, 500, 100)
|
| 54 |
+
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Middle Column: Chat Interface
|
| 57 |
with col2:
|
| 58 |
+
st.markdown("<div style='text-align: center;'><h1>Experiment With Querys</h1></div>", unsafe_allow_html=True)
|
| 59 |
|
| 60 |
# User ID Input
|
| 61 |
user_id = st.text_input("User ID:", key="user_id")
|
| 62 |
|
| 63 |
if not user_id:
|
| 64 |
+
st.warning("Please provide an experiment ID to start the chat.")
|
| 65 |
else:
|
| 66 |
# Initialize chat history
|
| 67 |
if "messages" not in st.session_state:
|
|
|
|
| 75 |
st.markdown(message["content"])
|
| 76 |
|
| 77 |
# Chat input at the bottom
|
| 78 |
+
if user_input := st.chat_input("Start Chat:"):
|
| 79 |
# Add user message
|
| 80 |
st.session_state.messages.append({"role": "user", "content": user_input})
|
| 81 |
st.chat_message("user").markdown(user_input)
|
|
|
|
| 89 |
persona2SystemMessage=persona2SystemMessage,
|
| 90 |
llm1=llm1,
|
| 91 |
tokens1=tokens1,
|
| 92 |
+
temperature1=0.,
|
| 93 |
userMessage2="",
|
| 94 |
+
llm2="GPT-4",
|
| 95 |
+
tokens2=500,
|
| 96 |
+
temperature2=0.1,
|
| 97 |
)
|
| 98 |
|
| 99 |
# Call the API
|