Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,6 +46,12 @@ st.markdown("""
|
|
| 46 |
.emoji {
|
| 47 |
font-size: 48px;
|
| 48 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
.stButton>button {
|
| 50 |
background-color: #ff4c4c;
|
| 51 |
color: white;
|
|
@@ -67,7 +73,7 @@ st.markdown("""
|
|
| 67 |
st.markdown('<div class="title">π AGE Calculator π</div>', unsafe_allow_html=True)
|
| 68 |
st.markdown('<div class="subtitle">Select your date of birth and let the magic begin β¨</div>', unsafe_allow_html=True)
|
| 69 |
|
| 70 |
-
# Session state for
|
| 71 |
if "dob" not in st.session_state:
|
| 72 |
st.session_state.dob = date(1990, 1, 1)
|
| 73 |
if "show_result" not in st.session_state:
|
|
@@ -81,7 +87,8 @@ dob = st.date_input(
|
|
| 81 |
value=st.session_state.dob
|
| 82 |
)
|
| 83 |
|
| 84 |
-
|
|
|
|
| 85 |
with col1:
|
| 86 |
if st.button("β¨ Calculate My Age"):
|
| 87 |
st.session_state.dob = dob
|
|
@@ -110,5 +117,6 @@ if st.session_state.show_result:
|
|
| 110 |
<div class="years">{years} Years</div>
|
| 111 |
<div class="months">{months} Months</div>
|
| 112 |
<div class="days">{days} Days</div>
|
|
|
|
| 113 |
</div>
|
| 114 |
""", unsafe_allow_html=True)
|
|
|
|
| 46 |
.emoji {
|
| 47 |
font-size: 48px;
|
| 48 |
}
|
| 49 |
+
.simple {
|
| 50 |
+
margin-top: 15px;
|
| 51 |
+
font-size: 20px;
|
| 52 |
+
color: #444;
|
| 53 |
+
font-style: italic;
|
| 54 |
+
}
|
| 55 |
.stButton>button {
|
| 56 |
background-color: #ff4c4c;
|
| 57 |
color: white;
|
|
|
|
| 73 |
st.markdown('<div class="title">π AGE Calculator π</div>', unsafe_allow_html=True)
|
| 74 |
st.markdown('<div class="subtitle">Select your date of birth and let the magic begin β¨</div>', unsafe_allow_html=True)
|
| 75 |
|
| 76 |
+
# Session state for DOB and result control
|
| 77 |
if "dob" not in st.session_state:
|
| 78 |
st.session_state.dob = date(1990, 1, 1)
|
| 79 |
if "show_result" not in st.session_state:
|
|
|
|
| 87 |
value=st.session_state.dob
|
| 88 |
)
|
| 89 |
|
| 90 |
+
# Buttons in columns
|
| 91 |
+
col1, col2 = st.columns(2)
|
| 92 |
with col1:
|
| 93 |
if st.button("β¨ Calculate My Age"):
|
| 94 |
st.session_state.dob = dob
|
|
|
|
| 117 |
<div class="years">{years} Years</div>
|
| 118 |
<div class="months">{months} Months</div>
|
| 119 |
<div class="days">{days} Days</div>
|
| 120 |
+
<div class="simple">You are {years} years, {months} months, and {days} days old.</div>
|
| 121 |
</div>
|
| 122 |
""", unsafe_allow_html=True)
|