Selectbox without re-running all script

Hey everyone.
My streamlit script works like this:

Inputs

  • Number of equations
  • Data to fit equations

Calculation

Takes too much time.
Randomly selecting x number of equations from the list and fit the data to these equations.

Results

Present the best-fit equation and a matplotlib plot.
Also, since equations are randomly chosen, a select box is presented. My aim was: If user want to select any other equation from the list (maybe best one is over-fitted), s/he can change it from the list.

Problem

However, if user selects another option from the select box, all scrip is re-run which cause:

  • Takes too much time.
  • Since equations are randomly chosen, select-box changes.

What I want to do?

When user select the equations from the list, best-fit equation and plot changes accordingly without re-running.

@Berk_Demir Hi mate, this problem you are facing don’t have a official solution until now. But there are some workarounds you could use as here A possible design for doing per-session persistent state in Streamlit Β· GitHub.

You can also check at The Streamlit Roadmap: Big Plans for 2020!; they are working on this problem and i think soon will be launch.

Cheers! :sunglasses: