Spaces:
No application file
No application file
Upload hello_streamlit_hf.py with huggingface_hub
Browse files- hello_streamlit_hf.py +31 -30
hello_streamlit_hf.py
CHANGED
|
@@ -1,30 +1,31 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from datetime import datetime
|
| 3 |
-
|
| 4 |
-
st.title("π Personalized Greeter App")
|
| 5 |
-
|
| 6 |
-
name = st.text_input("Enter your name:")
|
| 7 |
-
age = st.slider("Select your age:", 1, 100, 25)
|
| 8 |
-
|
| 9 |
-
hour = datetime.now().hour
|
| 10 |
-
if hour < 12:
|
| 11 |
-
greeting = "Good morning"
|
| 12 |
-
elif hour < 18:
|
| 13 |
-
greeting = "Good afternoon"
|
| 14 |
-
else:
|
| 15 |
-
greeting = "Good evening"
|
| 16 |
-
|
| 17 |
-
if name:
|
| 18 |
-
st.markdown(f"### {greeting}, {name}!")
|
| 19 |
-
st.write(f"You are {age} years old.")
|
| 20 |
-
|
| 21 |
-
if age < 18:
|
| 22 |
-
st.write("You're still young! π§")
|
| 23 |
-
elif age < 50:
|
| 24 |
-
st.write("You're in your prime! πΌ")
|
| 25 |
-
else:
|
| 26 |
-
st.write("You're wise and experienced! π΄π΅")
|
| 27 |
-
|
| 28 |
-
uploaded_file = st.file_uploader("Upload a profile picture (optional):", type=["png", "jpg", "jpeg"])
|
| 29 |
-
if uploaded_file:
|
| 30 |
-
st.image(uploaded_file, caption="Nice picture!", use_column_width=True)
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from datetime import datetime
|
| 3 |
+
|
| 4 |
+
st.title("π Personalized Greeter App")
|
| 5 |
+
|
| 6 |
+
name = st.text_input("Enter your name:")
|
| 7 |
+
age = st.slider("Select your age:", 1, 100, 25)
|
| 8 |
+
|
| 9 |
+
hour = datetime.now().hour
|
| 10 |
+
if hour < 12:
|
| 11 |
+
greeting = "Good morning"
|
| 12 |
+
elif hour < 18:
|
| 13 |
+
greeting = "Good afternoon"
|
| 14 |
+
else:
|
| 15 |
+
greeting = "Good evening"
|
| 16 |
+
|
| 17 |
+
if name:
|
| 18 |
+
st.markdown(f"### {greeting}, {name}!")
|
| 19 |
+
st.write(f"You are {age} years old.")
|
| 20 |
+
|
| 21 |
+
if age < 18:
|
| 22 |
+
st.write("You're still young! π§")
|
| 23 |
+
elif age < 50:
|
| 24 |
+
st.write("You're in your prime! πΌ")
|
| 25 |
+
else:
|
| 26 |
+
st.write("You're wise and experienced! π΄π΅")
|
| 27 |
+
|
| 28 |
+
uploaded_file = st.file_uploader("Upload a profile picture (optional):", type=["png", "jpg", "jpeg"])
|
| 29 |
+
if uploaded_file:
|
| 30 |
+
st.image(uploaded_file, caption="Nice picture!", use_column_width=True)
|
| 31 |
+
|