Hi , streamlit noob here , how can I get the input from user and store it into a list and print out?

For example ,

user type : Hello

output : Hello

user type : 2

output : Hello
output : 2

user type : World

output : Hello
ouput : 2
output : World

Thanks !!!

Hi @Root
Just following this video, do any one of the parts and you should be good to go with using streamlit!

Thanks but I managed to do something like what I wanted using session_state โ€ฆ

import streamlit as st
from streamlit_chat import message

message(โ€œWelcome to Streamlit-Chatโ€)

if โ€˜message_historyโ€™ not in st.session_state:
st.session_state.message_history =

for message_ in st.session_state.message_history:
message(message_,is_user=True) # display all the previous message

placeholder = st.empty() # placeholder for latest message
input_ = st.text_input(โ€œyouโ€)
st.session_state.message_history.append(input_)

with placeholder.container():
message( st.session_state.message_history[-1], is_user=True) # display the latest message

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.