      def __init__(self, arguments, samples, display, lock, trigger, config_tools, tk_vars):
          logger.debug("Initializing %s: (arguments: '%s', samples: %s: display: %s, lock: %s,"
                       " trigger: %s, config_tools: %s, tk_vars %s)", self.__class__.__name__,
                       arguments, samples, display, lock, trigger, config_tools, tk_vars)
          self.samples = samples
          self.queue_patch_in = queue_manager.get_queue("preview_patch_in")
          self.display = display
          self.lock = lock
          self.trigger = trigger
          self.current_config = config_tools.config
          self.converter_arguments = None  # Updated converter arguments dict
  
          configfile = arguments.configfile if hasattr(arguments, "configfile") else None
          self.converter = Converter(output_dir=None,
 
</s> remove     """ The patch pipeline
        To be run within it's own thread """
 </s> add     """ The Patch pipeline

    Runs in it's own thread. Takes the output from the Faceswap model predictor and runs the faces
    through the convert pipeline using the currently selected options.

    Parameters
    ----------
    arguments: :class:`argparse.Namespace`
        The :mod:`argparse` arguments as passed in from :mod:`tools.py`
    samples: :class:`Samples`
        The Samples for display.
    display: :class:`FacesDisplay`
        The display section of the Preview GUI.
    lock: :class:`threading.Lock`
        A threading lock to prevent multiple GUI updates at the same time.
    trigger:  :class:`threading.Event`
        An event to indicate that a converter patch should be run
    config_tools: :class:`ConfigTools`
        Tools for loading and saving configuration files
    tk_vars: dict
        Global tkinter variables. `Refresh` and `Busy` :class:`tkinter.BooleanVar`

    Attributes
    ----------
    converter_arguments: dict
        The currently selected converter command line arguments for the patch queue
    current_config::class:`lib.config.FaceswapConfig`
        The currently set configuration for the patch queue
    """ </s> remove         self.sample_size = sample_size
        self.display = display
        self.lock = lock
        self.trigger_patch = trigger_patch
        self.input_images = list()
        self.predicted_images = list()

        self.images = Images(arguments)
        self.alignments = Alignments(arguments,
                                     is_extract=False,
                                     input_is_video=self.images.is_video)
        if not self.alignments.have_alignments_file:
            logger.error("Alignments file not found at: '%s'", self.alignments.file)
 </s> add         self._sample_size = sample_size
        self._display = display
        self._lock = lock
        self._trigger_patch = trigger_patch
        self._input_images = list()
        self._predicted_images = list()

        self._images = Images(arguments)
        self._alignments = Alignments(arguments,
                                      is_extract=False,
                                      input_is_video=self._images.is_video)
        if not self._alignments.have_alignments_file:
            logger.error("Alignments file not found at: '%s'", self._alignments.file) </s> remove         self.converter = Converter(output_dir=None,
                                   output_size=self.samples.predictor.output_size,
                                   output_has_mask=self.samples.predictor.has_predicted_mask,
                                   draw_transparent=False,
                                   pre_encode=None,
                                   configfile=configfile,
                                   arguments=self.generate_converter_arguments(arguments))

        self.shutdown = Event()

        self.thread = MultiThread(self.process,
                                  self.trigger,
                                  self.shutdown,
                                  self.queue_patch_in,
                                  self.samples,
                                  tk_vars,
                                  thread_count=1,
                                  name="patch_thread")
        self.thread.start()
 </s> add         self._converter = Converter(output_size=self._samples.predictor.output_size,
                                    coverage_ratio=self._samples.predictor.coverage_ratio,
                                    draw_transparent=False,
                                    pre_encode=None,
                                    arguments=self._generate_converter_arguments(arguments),
                                    configfile=configfile)
        self._shutdown = Event()

        self._thread = MultiThread(self._process,
                                   self._trigger,
                                   self._shutdown,
                                   self._queue_patch_in,
                                   self._samples,
                                   tk_vars,
                                   thread_count=1,
                                   name="patch_thread")
        self._thread.start()

    @property
    def trigger(self):
        """ :class:`threading.Event`: The trigger to indicate that a patching run should
        commence. """
        return self._trigger

    @property
    def converter(self):
        """ :class:`lib.convert.Converter`: The converter to use for patching the images. """
        return self._converter </s> remove         self.args = arguments

        self.patch_threads = None
        self.images = Images(self.args)
        self.validate()
        self.alignments = Alignments(self.args, False, self.images.is_video)
        self.opts = OptionalActions(self.args, self.images.input_images, self.alignments)

        self.add_queues()
        self.disk_io = DiskIO(self.alignments, self.images, arguments)
        self.predictor = Predict(self.disk_io.load_queue, self.queue_size, arguments)

        configfile = self.args.configfile if hasattr(self.args, "configfile") else None
        self.converter = Converter(get_folder(self.args.output_dir),
                                   self.predictor.output_size,
                                   self.predictor.has_predicted_mask,
                                   self.disk_io.draw_transparent,
                                   self.disk_io.pre_encode,
                                   arguments,
                                   configfile=configfile)
 </s> add         self._args = arguments

        self._patch_threads = None
        self._images = Images(self._args)
        self._alignments = Alignments(self._args, False, self._images.is_video)

        self._opts = OptionalActions(self._args, self._images.input_images, self._alignments)

        self._add_queues()
        self._disk_io = DiskIO(self._alignments, self._images, arguments)
        self._predictor = Predict(self._disk_io.load_queue, self._queue_size, arguments)
        self._validate()
        get_folder(self._args.output_dir)

        configfile = self._args.configfile if hasattr(self._args, "configfile") else None
        self._converter = Converter(self._predictor.output_size,
                                    self._predictor.coverage_ratio,
                                    self._disk_io.draw_transparent,
                                    self._disk_io.pre_encode,
                                    arguments,
                                    configfile=configfile) </s> remove     """ Holds 5 random test faces """
 </s> add     """ The display samples.

    Obtains and holds :attr:`sample_size` semi random test faces for displaying in the
    preview GUI.

    The file list is split into evenly sized groups of :attr:`sample_size`. When a display set is
    generated, a random image from each of the groups is selected to provide an array of images
    across the length of the video.

    Parameters
    ----------
    arguments: :class:`argparse.Namespace`
        The :mod:`argparse` arguments as passed in from :mod:`tools.py`
    sample_size: int
        The number of samples to take from the input video/images
    display: :class:`FacesDisplay`
        The display section of the Preview GUI.
    lock: :class:`threading.Lock`
        A threading lock to prevent multiple GUI updates at the same time.
    trigger_patch:  :class:`threading.Event`
        An event to indicate that a converter patch should be run
    """
        self._samples = samples
        self._queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self._display = display
        self._lock = lock
        self._trigger = trigger
      def __init__(self, arguments, samples, display, lock, trigger, config_tools, tk_vars):
          logger.debug("Initializing %s: (arguments: '%s', samples: %s: display: %s, lock: %s,"
                       " trigger: %s, config_tools: %s, tk_vars %s)", self.__class__.__name__,
                       arguments, samples, display, lock, trigger, config_tools, tk_vars)
        self._samples = samples
        self._queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self._display = display
        self._lock = lock
        self._trigger = trigger
        self._samples = samples
        self._queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self._display = display
        self._lock = lock
        self._trigger = trigger
        self._samples = samples
        self._queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self._display = display
        self._lock = lock
        self._trigger = trigger
        self._samples = samples
        self._queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self._display = display
        self._lock = lock
        self._trigger = trigger
        self._samples = samples
        self._queue_patch_in = queue_manager.get_queue("preview_patch_in")
        self._display = display
        self._lock = lock
        self._trigger = trigger
          self.current_config = config_tools.config
          self.converter_arguments = None  # Updated converter arguments dict
  
          configfile = arguments.configfile if hasattr(arguments, "configfile") else None
          self.converter = Converter(output_dir=None,
keep keep keep keep replace replace replace replace replace keep keep keep keep keep
 Smart Masks to Convert (#957)

- scripts.convert - Use Smart Masks for Convert
    * Make on-the-fly conversion an explicit option

- Move BlurMask to lib.faces_detect

- tools.preview - Fix for smart masks
    * Subclass from tk.Tk
    * Options to lib.gui.control_helper
    *variable cleanup

- lib.logger - Demote more tensorflow deprecation messages

- Documentation:
    * lib.faces_detect.BlurMask
    * plugins.convert.mask
    * lib.convert
    * scripts.convert
    * scripts.fsmedia
    * tools.preview 
tools/preview.py