How to keep app run training model although app is closed?

I want to create ml tracker using Streamlit. but I don’t know how to keep training process running after we close the app.
Scenario:
If the model training take so long, we can close app and leave it for a while, and after training process done, we can use it immediately.

It’s not recommended to do actual model training in a streamlit app (at least not for complex models), if that’s what you mean. If you’re doing the training elsewhere, and want to simply use the model in your streamlit app once it’s ready, that should be doable.

If there’s some way of your app checking if the model has completed (e.g. if a certain file exists somewhere), then the simplest thing to do is just check for that file somewhere in your script, and add a “refresh” button at the top of the script. The button doesn’t actually have to do anything, but interacting with a widget like a button will cause your script to rerun. If you close the app and re-open it, it will also rerun, so it will check immediately to see if the model is present.

Does that answer your question?

I think its kind of subprocess implementation. So the streamlit just act as trigger for another py script

I would recommend making sure your trigger ends up running the training in a whole separate process, and then have your streamlit app just keep watching for some output file from the training to be there.