I am new to ST but I’m delighted with possibilities. I am currently developing a CRUD app but I have a refresh problem. Once the code is long I put toghter a smal code to mock my issue.
The main objetive is to present a text to the user, who needs to enter some sort of evaluation. The app then must record the text and the evaluation. The issue is that once I enter the text_input with the evaluation, the text (which is randomly selected) changes, and the app endup recording the user evaluation AND a newer text.
I tried cache, forms and session state, as well as I read all discussion topics and did a lot of tries. Nothing worked!
Thanks for helping!
import streamlit as st
from random import randint
def run():
number = str(randint(0,100))
st.write(f'Your number is: {number}')
input = st.text_input('How do you like this number?')
if not input:
st.stop()
else:
register(number, input)
return
def register(number, input):
st.write(f'the number is {number} and this is your response: {input}')
return
run()