Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -128,16 +128,24 @@ for group, subcriteria in criteria.items():
|
|
| 128 |
st.markdown(f"<div class='category-header'>{group}</div>", unsafe_allow_html=True)
|
| 129 |
for idx, crit in enumerate(subcriteria):
|
| 130 |
with st.container():
|
| 131 |
-
# Use two columns: one for the combined title/description, one for the include checkbox.
|
| 132 |
cols = st.columns([7, 0.5])
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 139 |
ratings.append(None if not include else rating)
|
| 140 |
|
|
|
|
| 141 |
if st.button("Calculate Score"):
|
| 142 |
result = calculate_score(ratings)
|
| 143 |
st.markdown(f"<h2 style='text-align:center;'>{result}</h2>", unsafe_allow_html=True)
|
|
|
|
| 128 |
st.markdown(f"<div class='category-header'>{group}</div>", unsafe_allow_html=True)
|
| 129 |
for idx, crit in enumerate(subcriteria):
|
| 130 |
with st.container():
|
|
|
|
| 131 |
cols = st.columns([7, 0.5])
|
| 132 |
+
combined_col = cols[0]
|
| 133 |
+
checkbox_col = cols[1]
|
| 134 |
+
# Define combined variable with the title and description
|
| 135 |
+
combined = (
|
| 136 |
+
f"<span class='criteria-name'>{crit['name']}</span>"
|
| 137 |
+
f" "
|
| 138 |
+
f"<span class='criteria-description'>{crit['description']}</span>"
|
| 139 |
+
)
|
| 140 |
+
combined_col.markdown(combined, unsafe_allow_html=True)
|
| 141 |
+
include = checkbox_col.checkbox("", value=True, key=f"include_{group}_{idx}")
|
| 142 |
+
# Place slider directly under the text in the same column
|
| 143 |
+
rating = combined_col.slider(
|
| 144 |
+
"", 1.0, 7.0, 4.0, step=0.1, key=f"slider_{group}_{idx}", disabled=(not include)
|
| 145 |
+
)
|
| 146 |
ratings.append(None if not include else rating)
|
| 147 |
|
| 148 |
+
|
| 149 |
if st.button("Calculate Score"):
|
| 150 |
result = calculate_score(ratings)
|
| 151 |
st.markdown(f"<h2 style='text-align:center;'>{result}</h2>", unsafe_allow_html=True)
|