2 columns, left side is a form asking for user name and email, right side is a line graph of a sine wave that is updating 100 times per second
Drop files here
or click to upload
import streamlit as st
import numpy as np
import time
# Set page layout to wide
st.set_page_config(layout="wide")
# Create two columns
col1, col2 = st.columns(2)
# Form column
with col1:
st.markdown("### User Information")
with st.form("user_form"):
name = st.text_input("Name")
email = st.text_input("Email")
submit = st.form_submit_button("Submit")
if submit:
st.success("Form submitted!")
st.write(f"Name: {name}")
st.write(f"Email: {email}")
# Real-time sine wave column
with col2:
st.markdown("### Real-time Sine Wave")
placeholder = st.empty()
# Create initial data
x = np.linspace(0, 10, 100)
while True:
# Update phase for animation
phase = time.time() % (2 * np.pi)
y = np.sin(x + phase)
# Plot the sine wave
chart_data = {"x": x, "y": y}
placeholder.line_chart(chart_data, use_container_width=True)
# Wait for 10ms (100 Hz update rate)
time.sleep(0.01)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?