Actually got it working used the solution using st.State posted here
I am trying to build a simple app where user will enter data & give feedback based on predicted result.
Code:
import streamlit as st
def main():
st.title("Data Categorization")
txt = st.text_area("Paste your data here..")
if st.button("Find Category"):
try:
if txt != '':
value = st.selectbox("Agree with result", ["Yes, I agree..", "Nah!! I don't"])
if st.button("Submit report"):
if value == "Yes, I agree..":
#st.write(value)
print('Do this ...')
…
by @andfanilo
Basic idea is to hold on to various “expensive-to-compute” things, like models, data, etc in the state object, so they are preserved between runs triggered by user buttons/input.
2 Likes