Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,27 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
# --- Configure the app ---
|
| 4 |
st.set_page_config(page_title="Multiplicity Demo", layout="centered")
|
| 5 |
|
|
@@ -10,12 +32,13 @@ if "page" not in st.session_state:
|
|
| 10 |
# --- Helper function to change page ---
|
| 11 |
def go_to(page_name):
|
| 12 |
st.session_state.page = page_name
|
| 13 |
-
|
| 14 |
|
| 15 |
# -----------------------------
|
| 16 |
# Landing Page
|
| 17 |
# -----------------------------
|
| 18 |
if st.session_state.page == "landing":
|
|
|
|
| 19 |
st.markdown(
|
| 20 |
"""
|
| 21 |
<div style='text-align: center; font-size:14px; color:gray;'>
|
|
@@ -31,28 +54,26 @@ if st.session_state.page == "landing":
|
|
| 31 |
if st.button("Get Started"):
|
| 32 |
go_to("main")
|
| 33 |
|
|
|
|
|
|
|
| 34 |
|
| 35 |
# -----------------------------
|
| 36 |
# Main Page (Clickable Sentences)
|
| 37 |
# -----------------------------
|
| 38 |
elif st.session_state.page == "main":
|
| 39 |
-
st.markdown(
|
| 40 |
-
"<div style='font-size:24px; color:#3366cc; font-weight:bold;'>Explore the concepts:</div>",
|
| 41 |
-
unsafe_allow_html=True
|
| 42 |
-
)
|
| 43 |
-
st.write("") # spacing
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
go_to(f"sentence_{i}")
|
| 55 |
|
|
|
|
| 56 |
|
| 57 |
# -----------------------------
|
| 58 |
# Empty Sentence Pages
|
|
@@ -61,6 +82,7 @@ else:
|
|
| 61 |
# Extract sentence index
|
| 62 |
sentence_index = int(st.session_state.page.split("_")[1])
|
| 63 |
|
|
|
|
| 64 |
st.markdown(
|
| 65 |
f"<div style='font-size:20px; color:#cc3333; font-weight:bold;'>Page for Sentence {sentence_index + 1}</div>",
|
| 66 |
unsafe_allow_html=True
|
|
@@ -70,3 +92,5 @@ else:
|
|
| 70 |
|
| 71 |
if st.button("Back to Main Page"):
|
| 72 |
go_to("main")
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
|
| 3 |
+
############# Style Setup ##############
|
| 4 |
+
st.markdown(
|
| 5 |
+
"""
|
| 6 |
+
<style>
|
| 7 |
+
.center-container {
|
| 8 |
+
display: flex;
|
| 9 |
+
flex-direction: column;
|
| 10 |
+
align-items: center;
|
| 11 |
+
text-align: center;
|
| 12 |
+
}
|
| 13 |
+
.clickable-sentence {
|
| 14 |
+
color: #3366cc;
|
| 15 |
+
cursor: pointer;
|
| 16 |
+
text-decoration: underline;
|
| 17 |
+
}
|
| 18 |
+
</style>
|
| 19 |
+
""",
|
| 20 |
+
unsafe_allow_html=True
|
| 21 |
+
)
|
| 22 |
+
########################################
|
| 23 |
+
|
| 24 |
+
|
| 25 |
# --- Configure the app ---
|
| 26 |
st.set_page_config(page_title="Multiplicity Demo", layout="centered")
|
| 27 |
|
|
|
|
| 32 |
# --- Helper function to change page ---
|
| 33 |
def go_to(page_name):
|
| 34 |
st.session_state.page = page_name
|
| 35 |
+
st.rerun()
|
| 36 |
|
| 37 |
# -----------------------------
|
| 38 |
# Landing Page
|
| 39 |
# -----------------------------
|
| 40 |
if st.session_state.page == "landing":
|
| 41 |
+
st.markdown("<div class='center-container'>", unsafe_allow_html=True)
|
| 42 |
st.markdown(
|
| 43 |
"""
|
| 44 |
<div style='text-align: center; font-size:14px; color:gray;'>
|
|
|
|
| 54 |
if st.button("Get Started"):
|
| 55 |
go_to("main")
|
| 56 |
|
| 57 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 58 |
+
|
| 59 |
|
| 60 |
# -----------------------------
|
| 61 |
# Main Page (Clickable Sentences)
|
| 62 |
# -----------------------------
|
| 63 |
elif st.session_state.page == "main":
|
| 64 |
+
st.markdown("<div class='center-container'>", unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
+
paragraph_html = """
|
| 67 |
+
<p style='font-size:20px; line-height:1.6; max-width:800px;'>
|
| 68 |
+
<a class='clickable-sentence' href='?page=sentence_0'>Multiplicity: Many models, same accuracy, different predictions.</a>
|
| 69 |
+
<a class='clickable-sentence' href='?page=sentence_1'>ICA Framework: Intentional, Conventional, and Arbitrary decisions.</a>
|
| 70 |
+
<a class='clickable-sentence' href='?page=sentence_2'>Arbitrariness: Why different models might treat individuals differently.</a>
|
| 71 |
+
<a class='clickable-sentence' href='?page=sentence_3'>Homogenization: Why similar decisions happen across many developers.</a>
|
| 72 |
+
</p>
|
| 73 |
+
"""
|
| 74 |
+
st.markdown(paragraph_html, unsafe_allow_html=True)
|
|
|
|
| 75 |
|
| 76 |
+
st.markdown("</div>", unsafe_allow_html=True)
|
| 77 |
|
| 78 |
# -----------------------------
|
| 79 |
# Empty Sentence Pages
|
|
|
|
| 82 |
# Extract sentence index
|
| 83 |
sentence_index = int(st.session_state.page.split("_")[1])
|
| 84 |
|
| 85 |
+
st.markdown("<div class='center-container'>", unsafe_allow_html=True)
|
| 86 |
st.markdown(
|
| 87 |
f"<div style='font-size:20px; color:#cc3333; font-weight:bold;'>Page for Sentence {sentence_index + 1}</div>",
|
| 88 |
unsafe_allow_html=True
|
|
|
|
| 92 |
|
| 93 |
if st.button("Back to Main Page"):
|
| 94 |
go_to("main")
|
| 95 |
+
|
| 96 |
+
st.markdown("</div>", unsafe_allow_html=True)
|