Load text_input/ number_input with value from loaded data

There are dozens of parameters in my application that I let the user save in a JSON file and upload them later. And because one parameter depends on other settings, the dependencies are coded like below so that if code or concrete_grade changes, the correct parameter values are loaded.

params_concrete['param_0'] = cols[0].text_input(concrete_param_names_per_code[code][0], concrete_grade_per_code[code][concrete_grade])
params_concrete['param_1'] = cols[1].text_input(concrete_param_names_per_code[code][1], concrete_alpha_per_code[code][concrete_grade])
params_concrete['param_2'] = cols[2].text_input(concrete_param_names_per_code[code][2], concrete_epsilon_c2_per_code[code][concrete_grade])
params_concrete['param_3'] = cols[3].text_input(concrete_param_names_per_code[code][3], concrete_epsilon_c2u_per_code[code][concrete_grade])

The user then can change any of the text inputs, save them in JSON file. Then the next time the user loads the file to use again. What can be a good way to assign saved parameters to those input cells? I often use session state for this purpose for independent input items, but for this case I do not know yet a solution because of the dependencies.


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.