some app
Drop files here
or click to upload
import streamlit as st
import pandas as pd
import numpy as np
st.title("Simple Streamlit App")
# Add a header
st.header("Welcome to Streamlit!")
# Add some text
st.write("This is a basic Streamlit application that demonstrates some core features.")
# Create a sidebar
st.sidebar.header("Controls")
option = st.sidebar.selectbox(
"Choose a visualization:",
["Data Table", "Chart", "Interactive Widget"]
)
# Generate some sample data
data = pd.DataFrame({
'Category': ['A', 'B', 'C', 'D', 'E'],
'Values': np.random.randint(1, 100, 5)
})
# Display content based on sidebar selection
if option == "Data Table":
st.subheader("Sample Data Table")
st.table(data)
elif option == "Chart":
st.subheader("Sample Bar Chart")
st.bar_chart(data.set_index('Category'))
elif option == "Interactive Widget":
st.subheader("Interactive Slider")
slider_val = st.slider("Select a value", 0, 100, 50)
st.write(f"You selected: {slider_val}")
if slider_val > 75:
st.success("That's a high value!")
elif slider_val < 25:
st.error("That's a low value!")
else:
st.info("That's a middle value!")
# Add a button to trigger an action
if st.button("Click me!"):
st.balloons()
st.write("Thanks for clicking!")
# Add a checkbox for additional content
show_extra = st.checkbox("Show extra content")
if show_extra:
st.subheader("Extra Content")
st.write("This content only appears when the checkbox is checked.")
# Create columns for layout
col1, col2 = st.columns(2)
with col1:
st.write("This is column 1")
st.metric(label="Temperature", value="70 °F", delta="1.2 °F")
with col2:
st.write("This is column 2")
st.metric(label="Humidity", value="45%", delta="-5%")
# Footer
st.markdown("---")
st.caption("Created with Streamlit")
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?