hello-streamlit-app / hello_streamlit_hf.py
gauravguha's picture
Upload hello_streamlit_hf.py with huggingface_hub
a8f8352 verified
raw
history blame contribute delete
833 Bytes
import streamlit as st
from datetime import datetime
st.title("πŸ‘‹ Personalized Greeter App")
name = st.text_input("Enter your name:")
age = st.slider("Select your age:", 1, 100, 25)
hour = datetime.now().hour
if hour < 12:
greeting = "Good morning"
elif hour < 18:
greeting = "Good afternoon"
else:
greeting = "Good evening"
if name:
st.markdown(f"### {greeting}, {name}!")
st.write(f"You are {age} years old.")
if age < 18:
st.write("You're still young! πŸ§’")
elif age < 50:
st.write("You're in your prime! πŸ’Ό")
else:
st.write("You're wise and experienced! πŸ‘΄πŸ‘΅")
uploaded_file = st.file_uploader("Upload a profile picture (optional):", type=["png", "jpg", "jpeg"])
if uploaded_file:
st.image(uploaded_file, caption="Nice picture!", use_column_width=True)