Spaces:
Sleeping
Sleeping
Download app.py from Muqadas-13/Age_Calculator: direct link, hf CLI and curl.
- Browser
- Download file 562 Bytes
-
https://huggingface.co/spaces/Muqadas-13/Age_Calculator/resolve/main/app.py
- Command line
-
hf download hf://spaces/Muqadas-13/Age_Calculator/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Muqadas-13/Age_Calculator/resolve/main/app.py
562 Bytes
| import streamlit as st | |
| from datetime import datetime, date | |
| st.set_page_config(page_title="Age Calculator", page_icon="๐") | |
| st.title("๐ Age Calculator") | |
| st.markdown("Enter your birthdate below to calculate your age:") | |
| birthdate = st.date_input( | |
| "Select your birthdate", | |
| min_value=date(1900, 1, 1), | |
| max_value=date.today() | |
| ) | |
| if st.button("Calculate Age"): | |
| today = date.today() | |
| age = today.year - birthdate.year - ( | |
| (today.month, today.day) < (birthdate.month, birthdate.day) | |
| ) | |
| st.success(f"Your age is: **{age}** years") | |