Spaces:
Sleeping
Sleeping
| 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() | |