title: How can I visualize the the training of neural network in real time?
body: <p>I am not using Pandas or PyTorch. I am using Keras and TensorFlow.</p>
  <pre><code># Visualize training history
  from keras.models import Sequential
  from keras.layers import Dense
  import matplotlib.pyplot as plt
  import numpy
  # load pima indians dataset
  dataset = numpy.loadtxt(&quot;file.txt&quot;, delimiter=&quot;,&quot;)
  # split into input (X) and output (Y) variables
  X = dataset[:,0:8]
  Y = dataset[:,8]
  # create model
  model = Sequential()
  model.add(Dense(12, input_dim=8, activation='relu'))
  model.add(Dense(8, activation='relu'))
  model.add(Dense(1, activation='sigmoid'))
  # Compile model
  model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])
  # Fit the model
  history = model.fit(X, Y, validation_split=0.33, epochs=150, batch_size=10, verbose=0)
  # list all data in history
  print(history.history.keys())
  # summarize history for accuracy
  plt.plot(history.history['accuracy'])
  plt.plot(history.history['val_accuracy'])
  plt.title('model accuracy')
  plt.ylabel('accuracy')
  plt.xlabel('epoch')
  plt.legend(['train', 'test'], loc='upper left')
  plt.show()
  # summarize history for loss
  plt.plot(history.history['loss'])
  plt.plot(history.history['val_loss'])
  plt.title('model loss')
  plt.ylabel('loss')
  plt.xlabel('epoch')
  plt.legend(['train', 'test'], loc='upper left')
  plt.show()
  </code></pre>
  <p>I found the above code <a href="https://machinelearningmastery.com/display-deep-learning-model-training-history-in-keras/" rel="nofollow noreferrer">somewhere on the Internet</a>.</p>
  <p>The problem with this code is, it doesn't show the training in <strong>real-time</strong>.</p>
  <p>How can I achieve that in Keras?</p>