      def set_tf_allow_growth(self):
          import_tensorflow_keras()
          config = tf.ConfigProto()
          config.gpu_options.allow_growth = True
          config.gpu_options.visible_device_list="0"
          set_session(tf.Session(config=config))
  
      preview_buffer = {}
  
      def show(self, image, name=''):
 
</s> remove     preview_buffer = {}

    def show(self, image, name=''):
 </s> add     def show(self, image, name=""):
        """ Generate the preview and write preview file output """ </s> remove     def set_tf_allow_growth(self):
        import_tensorflow_keras()
 </s> add     @staticmethod
    def set_tf_allow_growth():
        """ Allow TensorFlow to manage VRAM growth """ </s> remove             try:
                model.save_weights()
            except KeyboardInterrupt:
                print('Saving model weights has been cancelled!')
            exit(0)
        except Exception as e:
            raise e
            exit(1)
 </s> add             pass </s> remove             if self.arguments.redirect_gui:
                scriptpath = os.path.realpath(os.path.dirname(sys.argv[0]))
                img = '.gui_preview.png'
 </s> add             scriptpath = os.path.realpath(os.path.dirname(sys.argv[0]))
            if self.args.write_image:
                img = "_sample_{}.jpg".format(name)
                imgfile = os.path.join(scriptpath, img)
                cv2.imwrite(imgfile, image)

            if self.args.redirect_gui:
                img = ".gui_preview.png" </s> remove             skip = self.check_skipframe(filename)
            if self.arguments.discard_frames and skip:
                return
 </s> add         model = PluginLoader.get_model(model_name)(model_dir, num_gpus)
        config.gpu_options.visible_device_list = "0"
      def set_tf_allow_growth(self):
          import_tensorflow_keras()
          config = tf.ConfigProto()
          config.gpu_options.allow_growth = True
        config.gpu_options.visible_device_list = "0"
          set_session(tf.Session(config=config))
  
      preview_buffer = {}
  
      def show(self, image, name=''):
keep keep keep keep replace keep keep keep keep keep
 cli/scripts Refactor (#367)

* Refactor for PEP 8 and split process function

* Remove backwards compatibility for skip frames

* Split optional functions into own class. Make functions more modular

* Conform scripts folder to PEP 8

* train.py - Fix write image bug. Make more modular

* extract.py - Make more modular, Put optional actions into own class

* cli.py - start PEP 8

* cli,py - Pep 8. Refactor and make modular. Bugfixes

* 1st round refactor. Completely untested and probably broken.

* convert.py: Extract alignments from frames if they don't exist

* BugFix: SkipExisting broken since face name refactor

* Extract.py tested

* Minor formatting

* convert.py + train.py amended not tested

* train.py - Semi-fix for hang on reaching target iteration. Now quits on preview mode
Make tensorflow / system warning less verbose

* 2nd pass refactor. Semi tested

bugfixes

* Remove obsolete code. imread/write to Utils

* rename inout.py to fsmedia.py

* Final bugfixes 
scripts/train.py