I am new to Python and streamlit and working on a project. The model training part of my project takes a while during which the entire screen freezes and the user has to wait for some time before the results get displayed. The users cannot navigate to a different page while the model is being trainiend as the screen has frozen. I want to enable multi threading so that the training takes place on the secondary thread and the main thread continues. I have used the below piece of code:
The issue that I’m facing is that even though I have assigned a context to the thread, I’m getting below error on the terminal. What possibly could be going wrong?
I also want to display the training results (best model, hyperparameter values, etc) from the new_thread thread on the streamlit app, but I’m unable to do so. They’re getting displayed on the terminal but not on the app. Is this expected?
Once, the new thread (secondary thread)completes, I also want to device some mechanism that tells the main thread that the secondary thread has completed. is_alive() method checks whether a thread is alive and returns a boolean value based on the thread status but if I use this, I need to constantly run this command to check the status of my new thread. Can you please advise here as well?
Thanks a lot!