Problem with number input

Hi. I’m developing an app that takes a number input from a user. But sometimes when user click ‘+’ or ‘-’ button input field resets on default value (see on gif).
Запись активности на экране 2020-06-16 в 23.44.01
I use this code:

    target = self.pred_slot2.number_input(
        'HFT Target', min_value=0.0, max_value=0.5, value=0.3, step=0.01, format=None, key=None)
    if self.pred_slot3.button('Optimize '):
        self.current_model.optimise(target, pred, pred_opt)

where self.pred_slot2 - is st.empty() what saved before.

I understand what the value may changing to default after the button press. But if i clear understand - value don’t changed to default then user uses ‘+’ or ‘-’ button.
Can I avoid this some way? Am I doing something wrong?

Hi @levich, welcome to the Streamlit community!

Can you provide more of a code snippet so that we can try to debug? I see what you are saying in the gif, but without knowing how all of the code is interacting, it’s hard to say what the issue might be.

Best,
Randy