Getting predictions before taking inputs from user

Hi, as described in the title, I want to show the predictions only when the user types some input.

Here how it looks like

And here is the file

Hi @ARTiSticov,

Thank you for sharing with the Streamlit community!

A simple solution would be something like the following:

input = st.text_area('Enter your text', 'Type here')
if input != "Type here"
   with st.spinner('Doing AI things...'):
      output = model.predict(input)

In other words, just add an if statement which checks if the value of the text input is “Type here” before passing the input to your model.



1 Like