How to display the "Training Progress" on the app?

I want to display some kind of progress bar to display Current epochs, loss, accuracy or probably show some kind of live graph

Epoch 1/10
750/750 [==============================] - 38s 51ms/step - loss: 2.3055 - accuracy: 0.1098 - val_loss: 2.3030 - val_accuracy: 0.1060
Epoch 2/10
750/750 [==============================] - 46s 61ms/step - loss: 2.3040 - accuracy: 0.1090 - val_loss: 2.3019 - val_accuracy: 0.1081
Epoch 3/10
750/750 [==============================] - 40s 54ms/step - loss: 2.3031 - accuracy: 0.1114 - val_loss: 2.3007 - val_accuracy: 0.1060
Epoch 4/10
750/750 [==============================] - 45s 59ms/step - loss: 2.3021 - accuracy: 0.1139 - val_loss: 2.3012 - val_accuracy: 0.1347
Epoch 5/10
339/750 [============>…] - ETA: 19s - loss: 2.3010 - accuracy: 0.1150

How do I do that?

Hey @Mukesh_Iyer, welcome to the forum !

Have you checked st.progress :slight_smile: ? Tell us if it fits your needs or would need something more involved.

These epochs are being displayed on my command prompt. How do I combine it with the st.progress?
Or could you tell me way to display this training process on the web app

Could you share the code are you running, and how are you running it, so we can reproduce here and help you refactor the code ?

This looks like Tensorflow, so my guess is we would need to go into the source code of the training, get to the point where epochs are being incremented for the gradient descent and printed on the terminal, and replace that part with the st.progress context manager instead.

the code is mess i’m still working on it so.
And do let me know if you have any suggestions

If you want to get live feedbacks from the training process, you could perhaps rely on Keras custom callbacks. Inside your callbacks, you’ll be able to update your streamlit progress bar. You could even draw live graphs, but you may have to use st.empty() to create a placeholder and update your graphs.


This is handy, thanks @andfanilo. However (correct me if I’m wrong!) this cannot run at the same time as a cached function right?