Spaces:
Sleeping
Sleeping
Ashmi Banerjee
commited on
Commit
·
c96708d
1
Parent(s):
c2ca81b
added submit & resume later button
Browse files- views/nav_buttons.py +9 -2
- views/questions_screen.py +2 -2
views/nav_buttons.py
CHANGED
|
@@ -39,7 +39,7 @@ def navigation_buttons(data, response: Response):
|
|
| 39 |
|
| 40 |
current_index = st.session_state.current_index
|
| 41 |
|
| 42 |
-
col1, col2, col3 = st.columns([1, 1, 2])
|
| 43 |
|
| 44 |
with col1: # Back button #TODO fix: only gets ratings for the session, not from previous session
|
| 45 |
if st.button("Back", disabled=st.session_state.current_index == 0):
|
|
@@ -66,6 +66,13 @@ def navigation_buttons(data, response: Response):
|
|
| 66 |
if st.button("Finish"):
|
| 67 |
submit_feedback(current_index)
|
| 68 |
|
| 69 |
-
with col3: #
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
if st.button("Exit & Resume Later"):
|
| 71 |
submit_feedback(current_index)
|
|
|
|
| 39 |
|
| 40 |
current_index = st.session_state.current_index
|
| 41 |
|
| 42 |
+
col1, col2, col3, col4 = st.columns([1, 1, 1, 2])
|
| 43 |
|
| 44 |
with col1: # Back button #TODO fix: only gets ratings for the session, not from previous session
|
| 45 |
if st.button("Back", disabled=st.session_state.current_index == 0):
|
|
|
|
| 66 |
if st.button("Finish"):
|
| 67 |
submit_feedback(current_index)
|
| 68 |
|
| 69 |
+
with col3: # Submit button
|
| 70 |
+
if st.button("Submit & Resume Later"):
|
| 71 |
+
all_ratings = flatten_ratings(response)
|
| 72 |
+
if any(rating == 0 for rating in all_ratings):
|
| 73 |
+
st.warning("Please provide all ratings before submitting.")
|
| 74 |
+
else:
|
| 75 |
+
submit_feedback(current_index)
|
| 76 |
+
with col4: # Save & Resume Later button
|
| 77 |
if st.button("Exit & Resume Later"):
|
| 78 |
submit_feedback(current_index)
|
views/questions_screen.py
CHANGED
|
@@ -227,7 +227,7 @@ def questions_screen(data):
|
|
| 227 |
|
| 228 |
try:
|
| 229 |
config = data.iloc[current_index]
|
| 230 |
-
|
| 231 |
# Progress bar
|
| 232 |
progress = (current_index + 1) / len(data)
|
| 233 |
st.progress(progress)
|
|
@@ -247,7 +247,7 @@ def questions_screen(data):
|
|
| 247 |
# st.write("**Cities:**", config["city"])
|
| 248 |
# with st.expander("Full Context", expanded=False):
|
| 249 |
# st.text_area("", config["context"], height=300, disabled=False)
|
| 250 |
-
|
| 251 |
g_ratings = display_ratings_row("gemini", config, current_index)
|
| 252 |
l_ratings = display_ratings_row("llama", config, current_index)
|
| 253 |
|
|
|
|
| 227 |
|
| 228 |
try:
|
| 229 |
config = data.iloc[current_index]
|
| 230 |
+
st.markdown(f"## Hello {st.session_state.username.capitalize()} 👋")
|
| 231 |
# Progress bar
|
| 232 |
progress = (current_index + 1) / len(data)
|
| 233 |
st.progress(progress)
|
|
|
|
| 247 |
# st.write("**Cities:**", config["city"])
|
| 248 |
# with st.expander("Full Context", expanded=False):
|
| 249 |
# st.text_area("", config["context"], height=300, disabled=False)
|
| 250 |
+
st.markdown("### Rate the following queries based on the above context.")
|
| 251 |
g_ratings = display_ratings_row("gemini", config, current_index)
|
| 252 |
l_ratings = display_ratings_row("llama", config, current_index)
|
| 253 |
|