  from lib.gui.utils import get_images, get_config, initialize_config, initialize_images
  from lib.gui.custom_widgets import Tooltip
  from lib.gui.control_helper import ControlPanel, ControlPanelOption
  from lib.convert import Converter
  from lib.multithreading import MultiThread
  from lib.utils import FaceswapError
  from lib.queue_manager import queue_manager
  from scripts.fsmedia import Alignments, Images
  from scripts.convert import Predict
  
 
</s> remove from threading import Event, Lock
 </s> add from threading import Event, Lock, Thread </s> remove         self._thread = MultiThread(self._process,
                                   self._trigger,
                                   self._shutdown,
                                   self._queue_patch_in,
                                   self._samples,
                                   tk_vars,
                                   thread_count=1,
                                   name="patch_thread")
 </s> add         self._thread = Thread(target=self._process,
                              name="patch_thread",
                              args=(self._trigger,
                                    self._shutdown,
                                    self._queue_patch_in,
                                    self._samples,
                                    tk_vars),
                              daemon=True) </s> remove             mask = predicted_mask
 </s> add             mask = self._process_predicted_mask(predicted_mask)
  from lib.gui.utils import get_images, get_config, initialize_config, initialize_images
  from lib.gui.custom_widgets import Tooltip
  from lib.gui.control_helper import ControlPanel, ControlPanelOption
  from lib.convert import Converter

  from lib.utils import FaceswapError
  from lib.queue_manager import queue_manager
  from scripts.fsmedia import Alignments, Images
  from scripts.convert import Predict
  
keep keep keep keep replace keep keep keep keep keep
 Preview Tool fixes
  - Prevent errors from getting swallowed
  - Correctly handle None mask type
  - Consistent box blending 
tools/preview/preview.py