text: import matplotlib.pyplot as plt
  from keras.applications.imagenet_utils import preprocess_input
  from keras.preprocessing.image import img_to_array, load_img
  from numpy import array
  
  
  def prepare_image(path, x, y):
      image = load_img(path, target_size=(x, y))
      image = img_to_array(image)
      image = image.reshape((1, image.shape[0], image.shape[1], image.shape[2]))
      image = preprocess_input(image)
      return image
  
  
  def split_sequence(sequence, n_steps):
      X, y = list(), list()
      for i in range(len(sequence)):
          end_ix = i + n_steps
          if end_ix > len(sequence) - 1:
              break
          seq_x, seq_y = sequence[i:end_ix], sequence[end_ix]
          X.append(seq_x)
          y.append(seq_y)
      return array(X), array(y)
  
  
  def visualize_history(history):
      # Plot training & validation accuracy values
      plt.plot(history.history['acc'])
      plt.plot(history.history['val_acc'])
      plt.title('Model accuracy')
      plt.ylabel('Accuracy')
      plt.xlabel('Epoch')
      plt.legend(['Train', 'Test'], loc='upper left')
      plt.show()
  
      # Plot training & validation loss values
      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()
  
  