an app with a command line like interface that echos what I say
To upload files, please first save the app
import streamlit as st
st.title("CLI Echo")
st.write("Type something and I'll echo it back!")
# Initialize history if it doesn't exist
if "history" not in st.session_state:
st.session_state.history = []
# Get user input
user_input = st.text_input("$ ", key="command_input")
# When user submits something
if user_input:
# Add to history
st.session_state.history.append(f"$ {user_input}")
st.session_state.history.append(user_input)
# Clear the input
st.session_state.command_input = ""
# Display history
for line in st.session_state.history:
st.text(line)
Hi! I can help you with any questions about Streamlit and Python. What would you like to know?