Spaces:
Sleeping
Sleeping
File size: 1,320 Bytes
5988c18 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
import streamlit as st
def main():
"""
This is the main function that runs the Streamlit application.
It sets up the title, displays a greeting, and takes user input.
"""
st.set_page_config(page_title="My Simple Streamlit App", layout="centered")
# --- Title and Header ---
st.title("π Welcome to My First Streamlit App!")
st.markdown("""
This is a simple demonstration of what Streamlit can do.
It's incredibly easy to build interactive web applications with just Python!
""")
st.write("---") # Horizontal line for separation
# --- User Input Section ---
st.header("Tell Us About Yourself!")
user_name = st.text_input("What's your name?", "Guest") # Text input with a default value
# Create a button
if st.button("Say Hello!"):
# Display a personalized greeting when the button is clicked
st.success(f"Hello, {user_name}! It's great to see you here. π")
else:
st.info("Enter your name above and click 'Say Hello!'")
st.write("---")
# --- More Content (Optional) ---
st.subheader("Explore More")
st.write("Feel free to modify this code and experiment with other Streamlit widgets!")
st.markdown("[Streamlit Documentation](https://docs.streamlit.io/)")
if __name__ == "__main__":
main()
|