Create a streamlit application with input parameters on the left and display on the right. The input parameters are given as a dataframe. Assume there are 10 rows, and the input columns are name, is_active, and values. Name is a string. Is_active is boolean, and values is an array of floating values. Add a button to Display the input. When the user clicks ok display the input is displayed on the right panel.
Drop files here
or click to upload
import streamlit as st
import pandas as pd
# Create a sample dataframe
if "data" not in st.session_state:
st.session_state.data = pd.DataFrame({
"name": [f"Item {i}" for i in range(10)],
"is_active": [True, False] * 5,
"values": [[float(i) for i in range(5)] for _ in range(10)]
})
# Sidebar for input parameters
st.sidebar.title("Input Parameters")
input_data = st.sidebar.dataframe(st.session_state.data)
# Display button
if st.sidebar.button("Display Input"):
st.write("### Input Data")
st.table(st.session_state.data)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?