Spaces:
Running
Running
Update src/GVHD_Predictions_App.py
Browse files- src/GVHD_Predictions_App.py +124 -117
src/GVHD_Predictions_App.py
CHANGED
|
@@ -1,118 +1,125 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
import os
|
| 3 |
-
import base64
|
| 4 |
-
|
| 5 |
-
def load_image_as_base64(image_path):
|
| 6 |
-
repo_root = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
-
image_path = os.path.join(repo_root, image_path)
|
| 8 |
-
with open(image_path, "rb") as f:
|
| 9 |
-
data = f.read()
|
| 10 |
-
return base64.b64encode(data).decode()
|
| 11 |
-
|
| 12 |
-
# Read image and encode in base64
|
| 13 |
-
|
| 14 |
-
logo_as_base64 = load_image_as_base64(os.path.join("img", "GVHD-Orgs-logo.png"))
|
| 15 |
-
|
| 16 |
-
st.set_page_config(page_title="GVHD Predictions", layout="wide")
|
| 17 |
-
|
| 18 |
-
# --- Flexible Footer CSS ---
|
| 19 |
-
st.markdown(
|
| 20 |
-
"""
|
| 21 |
-
<style>
|
| 22 |
-
/* Make the main Streamlit container use flex layout */
|
| 23 |
-
.stApp {
|
| 24 |
-
display: flex;
|
| 25 |
-
flex-direction: column;
|
| 26 |
-
min-height: 100vh; /* full viewport height */
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
/* Content grows naturally */
|
| 30 |
-
.main-content {
|
| 31 |
-
flex: 1;
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
/* Footer styling */
|
| 35 |
-
.footer {
|
| 36 |
-
margin-top: auto; /* pushes footer to bottom */
|
| 37 |
-
text-align: center;
|
| 38 |
-
font-size: 14px;
|
| 39 |
-
color: grey;
|
| 40 |
-
opacity: 0.8;
|
| 41 |
-
padding: 10px 5px;
|
| 42 |
-
line-height: 1.4;
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
/* Responsive adjustments for mobile */
|
| 46 |
-
@media (max-width: 600px) {
|
| 47 |
-
.footer {
|
| 48 |
-
font-size: 12px;
|
| 49 |
-
padding: 8px 5px;
|
| 50 |
-
}
|
| 51 |
-
}
|
| 52 |
-
</style>
|
| 53 |
-
""",
|
| 54 |
-
unsafe_allow_html=True
|
| 55 |
-
)
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
#
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
"""
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
st.
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
""
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
)
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import os
|
| 3 |
+
import base64
|
| 4 |
+
|
| 5 |
+
def load_image_as_base64(image_path):
|
| 6 |
+
repo_root = os.path.dirname(os.path.abspath(__file__))
|
| 7 |
+
image_path = os.path.join(repo_root, image_path)
|
| 8 |
+
with open(image_path, "rb") as f:
|
| 9 |
+
data = f.read()
|
| 10 |
+
return base64.b64encode(data).decode()
|
| 11 |
+
|
| 12 |
+
# Read image and encode in base64
|
| 13 |
+
|
| 14 |
+
logo_as_base64 = load_image_as_base64(os.path.join("img", "GVHD-Orgs-logo.png"))
|
| 15 |
+
|
| 16 |
+
st.set_page_config(page_title="GVHD Predictions", layout="wide")
|
| 17 |
+
|
| 18 |
+
# --- Flexible Footer CSS ---
|
| 19 |
+
st.markdown(
|
| 20 |
+
"""
|
| 21 |
+
<style>
|
| 22 |
+
/* Make the main Streamlit container use flex layout */
|
| 23 |
+
.stApp {
|
| 24 |
+
display: flex;
|
| 25 |
+
flex-direction: column;
|
| 26 |
+
min-height: 100vh; /* full viewport height */
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/* Content grows naturally */
|
| 30 |
+
.main-content {
|
| 31 |
+
flex: 1;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
/* Footer styling */
|
| 35 |
+
.footer {
|
| 36 |
+
margin-top: auto; /* pushes footer to bottom */
|
| 37 |
+
text-align: center;
|
| 38 |
+
font-size: 14px;
|
| 39 |
+
color: grey;
|
| 40 |
+
opacity: 0.8;
|
| 41 |
+
padding: 10px 5px;
|
| 42 |
+
line-height: 1.4;
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
/* Responsive adjustments for mobile */
|
| 46 |
+
@media (max-width: 600px) {
|
| 47 |
+
.footer {
|
| 48 |
+
font-size: 12px;
|
| 49 |
+
padding: 8px 5px;
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
</style>
|
| 53 |
+
""",
|
| 54 |
+
unsafe_allow_html=True
|
| 55 |
+
)
|
| 56 |
+
|
| 57 |
+
st.markdown("""
|
| 58 |
+
<div style="text-align:center">
|
| 59 |
+
|
| 60 |
+
## GVHD-Intel Pro
|
| 61 |
+
|
| 62 |
+
### Clinical Decision-Support & Outcome Simulation Platform
|
| 63 |
+
|
| 64 |
+
Interactive framework enabling transplant physicians to explore how different
|
| 65 |
+
patient, donor, and conditioning variables influence:
|
| 66 |
+
|
| 67 |
+
• Acute GVHD incidence
|
| 68 |
+
• Chronic GVHD risk
|
| 69 |
+
• Overall survival probability
|
| 70 |
+
|
| 71 |
+
Compare scenarios and identify combinations associated with lower predicted risk
|
| 72 |
+
to support evidence-informed transplant planning.
|
| 73 |
+
|
| 74 |
+
</div>
|
| 75 |
+
""", unsafe_allow_html=True)
|
| 76 |
+
|
| 77 |
+
# add GVHD tagline
|
| 78 |
+
st.markdown("""
|
| 79 |
+
<div style="text-align:center">
|
| 80 |
+
<h3>
|
| 81 |
+
A modular prediction framework for Acute & Chronic GVHD risk assessment.<br>
|
| 82 |
+
<i>Predict. Learn. Adapt.</i>
|
| 83 |
+
</h3>
|
| 84 |
+
</div>
|
| 85 |
+
""", unsafe_allow_html=True)
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
# --- Partners Section ---
|
| 89 |
+
st.divider()
|
| 90 |
+
st.subheader("Partners:")
|
| 91 |
+
st.markdown(
|
| 92 |
+
f"""
|
| 93 |
+
<div style="text-align:center">
|
| 94 |
+
<img src="data:image/png;base64,{logo_as_base64}" style="width:100%; max-width:1000px;">
|
| 95 |
+
</div>
|
| 96 |
+
""",
|
| 97 |
+
unsafe_allow_html=True
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
# --- Disclaimer Section ---
|
| 102 |
+
st.divider()
|
| 103 |
+
st.write(
|
| 104 |
+
"""
|
| 105 |
+
**Disclaimer: Experimental research platform — not approved for clinical use.**\\
|
| 106 |
+
Modular AI-driven framework that centers can retrain with their own multi-center datasets to build and validate population-specific GVHD prediction models.\\
|
| 107 |
+
Model performance varies by training data and updates.
|
| 108 |
+
""")
|
| 109 |
+
|
| 110 |
+
st.markdown('</div>', unsafe_allow_html=True)
|
| 111 |
+
# --- End of MAIN CONTENT ---
|
| 112 |
+
|
| 113 |
+
# --- Footer ---
|
| 114 |
+
st.markdown(
|
| 115 |
+
"""
|
| 116 |
+
<div class="footer">
|
| 117 |
+
<br>
|
| 118 |
+
<br>
|
| 119 |
+
©2025 Department of Health – Abu Dhabi<br>
|
| 120 |
+
Partnership: SSMC (PureHealth) & MBZUAI<br>
|
| 121 |
+
Data Collaborators: SKMC, Tawam Hospital, KHCC (Jordan)
|
| 122 |
+
</div>
|
| 123 |
+
""",
|
| 124 |
+
unsafe_allow_html=True
|
| 125 |
)
|