Spaces:
Sleeping
Sleeping
Ashmi Banerjee
commited on
Commit
·
a8f91fb
1
Parent(s):
2d1eb60
bug fix
Browse files- app.py +2 -2
- requirements.txt +2 -1
- views/nav_buttons.py +19 -5
- views/questions_screen.py +1 -1
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import streamlit as st
|
|
| 4 |
import os
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
from views.intro_screen import welcome_screen
|
| 7 |
-
from views.questions_screen import questions_screen
|
| 8 |
from views.continue_survey import continue_survey_screen
|
| 9 |
from css.layout import custom_css
|
| 10 |
st.set_page_config(layout="wide")
|
|
@@ -81,7 +81,7 @@ def ui():
|
|
| 81 |
if st.session_state.current_index >= len(data):
|
| 82 |
# If all questions have been answered, show the exit screen
|
| 83 |
print("survey completed")
|
| 84 |
-
|
| 85 |
# Otherwise, show questions from where they left off
|
| 86 |
questions_screen(data)
|
| 87 |
else:
|
|
|
|
| 4 |
import os
|
| 5 |
from dotenv import load_dotenv
|
| 6 |
from views.intro_screen import welcome_screen
|
| 7 |
+
from views.questions_screen import questions_screen, display_completion_message
|
| 8 |
from views.continue_survey import continue_survey_screen
|
| 9 |
from css.layout import custom_css
|
| 10 |
st.set_page_config(layout="wide")
|
|
|
|
| 81 |
if st.session_state.current_index >= len(data):
|
| 82 |
# If all questions have been answered, show the exit screen
|
| 83 |
print("survey completed")
|
| 84 |
+
display_completion_message()
|
| 85 |
# Otherwise, show questions from where they left off
|
| 86 |
questions_screen(data)
|
| 87 |
else:
|
requirements.txt
CHANGED
|
@@ -2,4 +2,5 @@ streamlit
|
|
| 2 |
pandas
|
| 3 |
python-dotenv
|
| 4 |
firebase-admin
|
| 5 |
-
pydantic
|
|
|
|
|
|
| 2 |
pandas
|
| 3 |
python-dotenv
|
| 4 |
firebase-admin
|
| 5 |
+
pydantic
|
| 6 |
+
datasets
|
views/nav_buttons.py
CHANGED
|
@@ -59,12 +59,26 @@ def navigation_buttons(data, response: Response):
|
|
| 59 |
st.warning("Please provide all ratings before proceeding.")
|
| 60 |
else:
|
| 61 |
if current_index < len(data) - 1:
|
| 62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
st.session_state.current_index += 1
|
| 64 |
-
st.rerun()
|
| 65 |
-
else:
|
| 66 |
-
if st.button("Finish"):
|
| 67 |
-
submit_feedback(current_index)
|
| 68 |
|
| 69 |
with col3: # Submit button
|
| 70 |
if st.button("Submit & Resume Later"):
|
|
|
|
| 59 |
st.warning("Please provide all ratings before proceeding.")
|
| 60 |
else:
|
| 61 |
if current_index < len(data) - 1:
|
| 62 |
+
config_id = data.iloc[st.session_state.current_index]['config_id']
|
| 63 |
+
if isinstance(response.model_ratings, dict):
|
| 64 |
+
st.session_state.previous_ratings[config_id] = {
|
| 65 |
+
model: {
|
| 66 |
+
'query_v_ratings': ratings.query_v_ratings,
|
| 67 |
+
'query_p0_ratings': ratings.query_p0_ratings,
|
| 68 |
+
'query_p1_ratings': ratings.query_p1_ratings
|
| 69 |
+
}
|
| 70 |
+
for model, ratings in response.model_ratings.items()
|
| 71 |
+
}
|
| 72 |
+
else:
|
| 73 |
+
st.session_state.previous_ratings[config_id] = {
|
| 74 |
+
model: {
|
| 75 |
+
'query_v_ratings': getattr(ratings, 'query_v_ratings', {}),
|
| 76 |
+
'query_p0_ratings': getattr(ratings, 'query_p0_ratings', {}),
|
| 77 |
+
'query_p1_ratings': getattr(ratings, 'query_p1_ratings', {})
|
| 78 |
+
}
|
| 79 |
+
for model, ratings in response.model_ratings.items()
|
| 80 |
+
}
|
| 81 |
st.session_state.current_index += 1
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
with col3: # Submit button
|
| 84 |
if st.button("Submit & Resume Later"):
|
views/questions_screen.py
CHANGED
|
@@ -85,7 +85,7 @@ def render_single_rating(
|
|
| 85 |
options=options,
|
| 86 |
format_func=format_func,
|
| 87 |
key=f"{key_prefix}",
|
| 88 |
-
index=stored_rating if stored_rating is not None else
|
| 89 |
)
|
| 90 |
|
| 91 |
|
|
|
|
| 85 |
options=options,
|
| 86 |
format_func=format_func,
|
| 87 |
key=f"{key_prefix}",
|
| 88 |
+
index=stored_rating if stored_rating is not None else None,
|
| 89 |
)
|
| 90 |
|
| 91 |
|