Spaces:
Sleeping
Sleeping
Ashmi Banerjee commited on
Commit ·
6cdfa00
1
Parent(s): 48fa8cf
updated questions
Browse files- views/intro_screen.py +3 -1
- views/questions_screen.py +24 -15
views/intro_screen.py
CHANGED
|
@@ -29,7 +29,9 @@ def welcome_screen():
|
|
| 29 |
next_button = st.button("Next")
|
| 30 |
footer_html = """<div style='text-align: center; background-color:#ECECEC;padding:3rem;'> <p
|
| 31 |
style='font-size: large;'>⚠️ Note: This is still a work in progress. <br> If you encounter bugs or issues
|
| 32 |
-
please create a Pull Request and we will look into it
|
|
|
|
|
|
|
| 33 |
st.markdown(footer_html, unsafe_allow_html=True)
|
| 34 |
|
| 35 |
if (username_input and validation_code_input) or next_button:
|
|
|
|
| 29 |
next_button = st.button("Next")
|
| 30 |
footer_html = """<div style='text-align: center; background-color:#ECECEC;padding:3rem;'> <p
|
| 31 |
style='font-size: large;'>⚠️ Note: This is still a work in progress. <br> If you encounter bugs or issues
|
| 32 |
+
please create a Pull Request and we will look into it.
|
| 33 |
+
<br><span style='color: red;'>For best results, please use a desktop browser.</span> </p>
|
| 34 |
+
</div> """
|
| 35 |
st.markdown(footer_html, unsafe_allow_html=True)
|
| 36 |
|
| 37 |
if (username_input and validation_code_input) or next_button:
|
views/questions_screen.py
CHANGED
|
@@ -5,6 +5,7 @@ from dotenv import load_dotenv
|
|
| 5 |
from views.nav_buttons import navigation_buttons
|
| 6 |
import random
|
| 7 |
from utils.loaders import load_html
|
|
|
|
| 8 |
load_dotenv()
|
| 9 |
|
| 10 |
|
|
@@ -108,6 +109,7 @@ def render_query_ratings(
|
|
| 108 |
stored_query_ratings = get_previous_ratings(model_name, query_key, current_index)
|
| 109 |
stored_groundedness = stored_query_ratings.get("groundedness", 0)
|
| 110 |
stored_clarity = stored_query_ratings.get("clarity", 0)
|
|
|
|
| 111 |
stored_persona_alignment = (
|
| 112 |
stored_query_ratings.get("persona_alignment", 0) if has_persona_alignment else 0
|
| 113 |
)
|
|
@@ -129,9 +131,18 @@ def render_query_ratings(
|
|
| 129 |
""",
|
| 130 |
unsafe_allow_html=True,
|
| 131 |
)
|
| 132 |
-
cols = st.columns(
|
| 133 |
options = [0, 1, 2, 3, 4]
|
| 134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
persona_alignment_rating = None
|
| 136 |
if has_persona_alignment:
|
| 137 |
persona_alignment_rating = render_single_rating(
|
|
@@ -142,33 +153,31 @@ def render_query_ratings(
|
|
| 142 |
],
|
| 143 |
f"rating_{model_name}{query_key}_persona_alignment_",
|
| 144 |
stored_persona_alignment,
|
| 145 |
-
cols[
|
| 146 |
)
|
| 147 |
|
| 148 |
-
groundedness_rating = render_single_rating(
|
| 149 |
-
"Groundedness:",
|
| 150 |
-
options,
|
| 151 |
-
lambda x: ["N/A", "Not Grounded", "Partially Grounded", "Grounded", "Unclear"][
|
| 152 |
-
x
|
| 153 |
-
],
|
| 154 |
-
f"rating_{model_name}{query_key}_groundedness_",
|
| 155 |
-
stored_groundedness,
|
| 156 |
-
cols[1],
|
| 157 |
-
)
|
| 158 |
-
|
| 159 |
clarity_rating = render_single_rating(
|
| 160 |
"Clarity:",
|
| 161 |
[0, 1, 2, 3],
|
| 162 |
lambda x: ["N/A", "Not Clear", "Somewhat Clear", "Very Clear"][x],
|
| 163 |
f"rating_{model_name}{query_key}_clarity_",
|
| 164 |
stored_clarity,
|
| 165 |
-
cols[2],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
)
|
| 167 |
|
| 168 |
return {
|
| 169 |
"clarity": clarity_rating,
|
| 170 |
"groundedness": groundedness_rating,
|
| 171 |
"persona_alignment": persona_alignment_rating if has_persona_alignment else None,
|
|
|
|
| 172 |
}
|
| 173 |
|
| 174 |
|
|
|
|
| 5 |
from views.nav_buttons import navigation_buttons
|
| 6 |
import random
|
| 7 |
from utils.loaders import load_html
|
| 8 |
+
|
| 9 |
load_dotenv()
|
| 10 |
|
| 11 |
|
|
|
|
| 109 |
stored_query_ratings = get_previous_ratings(model_name, query_key, current_index)
|
| 110 |
stored_groundedness = stored_query_ratings.get("groundedness", 0)
|
| 111 |
stored_clarity = stored_query_ratings.get("clarity", 0)
|
| 112 |
+
stored_overall_rating = stored_query_ratings.get("overall", 0)
|
| 113 |
stored_persona_alignment = (
|
| 114 |
stored_query_ratings.get("persona_alignment", 0) if has_persona_alignment else 0
|
| 115 |
)
|
|
|
|
| 131 |
""",
|
| 132 |
unsafe_allow_html=True,
|
| 133 |
)
|
| 134 |
+
cols = st.columns(4)
|
| 135 |
options = [0, 1, 2, 3, 4]
|
| 136 |
+
groundedness_rating = render_single_rating(
|
| 137 |
+
"Groundedness:",
|
| 138 |
+
options,
|
| 139 |
+
lambda x: ["N/A", "Not Grounded", "Partially Grounded", "Grounded", "Unclear"][
|
| 140 |
+
x
|
| 141 |
+
],
|
| 142 |
+
f"rating_{model_name}{query_key}_groundedness_",
|
| 143 |
+
stored_groundedness,
|
| 144 |
+
cols[0],
|
| 145 |
+
)
|
| 146 |
persona_alignment_rating = None
|
| 147 |
if has_persona_alignment:
|
| 148 |
persona_alignment_rating = render_single_rating(
|
|
|
|
| 153 |
],
|
| 154 |
f"rating_{model_name}{query_key}_persona_alignment_",
|
| 155 |
stored_persona_alignment,
|
| 156 |
+
cols[1],
|
| 157 |
)
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
clarity_rating = render_single_rating(
|
| 160 |
"Clarity:",
|
| 161 |
[0, 1, 2, 3],
|
| 162 |
lambda x: ["N/A", "Not Clear", "Somewhat Clear", "Very Clear"][x],
|
| 163 |
f"rating_{model_name}{query_key}_clarity_",
|
| 164 |
stored_clarity,
|
| 165 |
+
cols[2] if has_persona_alignment else cols[1],
|
| 166 |
+
)
|
| 167 |
+
overall_rating = render_single_rating(
|
| 168 |
+
"Overall rating:",
|
| 169 |
+
[0, 1, 2, 3],
|
| 170 |
+
lambda x: ["N/A", "Not Clear", "Somewhat Clear", "Very Clear"][x],
|
| 171 |
+
f"rating_{model_name}{query_key}_overall_",
|
| 172 |
+
stored_overall_rating,
|
| 173 |
+
cols[3] if has_persona_alignment else cols[2],
|
| 174 |
)
|
| 175 |
|
| 176 |
return {
|
| 177 |
"clarity": clarity_rating,
|
| 178 |
"groundedness": groundedness_rating,
|
| 179 |
"persona_alignment": persona_alignment_rating if has_persona_alignment else None,
|
| 180 |
+
"overall": overall_rating,
|
| 181 |
}
|
| 182 |
|
| 183 |
|