Spaces:
No application file
No application file
Download App.py from mohsin06/Userinterface: direct link, hf CLI and curl.
- Browser
- Download file 1.78 kB
-
https://huggingface.co/spaces/mohsin06/Userinterface/resolve/main/App.py
- Command line
-
hf download hf://spaces/mohsin06/Userinterface/App.py
-
curl -L -o App.py https://huggingface.co/spaces/mohsin06/Userinterface/resolve/main/App.py
1.78 kB
| import streamlit as st | |
| # App title | |
| st.title("Streamlit User Interface Showcase") | |
| # Sidebar for navigation | |
| st.sidebar.header("Navigation") | |
| page = st.sidebar.radio("Go to", ["Home", "Widgets", "Layouts"]) | |
| # Home Page | |
| if page == "Home": | |
| st.header("Welcome to the Streamlit UI Showcase!") | |
| st.write("This app demonstrates the use of various Streamlit components.") | |
| st.image( | |
| "https://docs.streamlit.io/logo.png", | |
| caption="Streamlit makes building apps easy!", | |
| use_column_width=True, | |
| ) | |
| # Widgets Page | |
| elif page == "Widgets": | |
| st.header("Widgets in Streamlit") | |
| st.subheader("Text Input") | |
| name = st.text_input("What's your name?") | |
| if name: | |
| st.write(f"Hello, {name}!") | |
| st.subheader("Slider") | |
| age = st.slider("How old are you?", 0, 100, 25) | |
| st.write(f"You are {age} years old.") | |
| st.subheader("Select Box") | |
| color = st.selectbox("What's your favorite color?", ["Red", "Blue", "Green"]) | |
| st.write(f"Your favorite color is {color}.") | |
| st.subheader("Checkbox") | |
| agree = st.checkbox("I agree to the terms and conditions.") | |
| if agree: | |
| st.success("Thank you for agreeing!") | |
| st.subheader("Button") | |
| if st.button("Click me"): | |
| st.balloons() | |
| # Layouts Page | |
| elif page == "Layouts": | |
| st.header("Layouts in Streamlit") | |
| st.subheader("Columns") | |
| col1, col2, col3 = st.columns(3) | |
| col1.button("Column 1") | |
| col2.button("Column 2") | |
| col3.button("Column 3") | |
| st.subheader("Tabs") | |
| tab1, tab2 = st.tabs(["Tab 1", "Tab 2"]) | |
| with tab1: | |
| st.write("This is Tab 1.") | |
| with tab2: | |
| st.write("This is Tab 2.") | |
| st.subheader("Expander") | |
| with st.expander("See more"): | |
| st.write("This is additional information inside an expander.") | |