          event: :class:`tkinter.Event`
              The key press event
          """
          move_axis = self._canvas.xview if event.keysym in ("Left", "Right") else self._canvas.yview
          visible = (move_axis()[1] - move_axis()[0])
          amount = -visible / 25 if event.keysym in ("Up", "Left") else visible / 25
          logger.trace("Key move event: (event: %s, move_axis: %s, visible: %s, "  # type: ignore
                       "amount: %s)", move_axis, visible, amount)
          move_axis(tk.MOVETO, min(1.0, max(0.0, move_axis()[0] + amount)))
  
 
</s> remove         old_face = cast(np.ndarray, reference_face.face)[..., :3] / 255.0
 </s> add         old_face = T.cast(np.ndarray, reference_face.face)[..., :3] / 255.0 </s> remove         key = cast(TriggerKeysType, keypress)
 </s> add         key = T.cast(TriggerKeysType, keypress) </s> remove         self._image: Optional["np.ndarray"] = image
        self._image_shape = cast(Tuple[int, int, int], image.shape)
        self._detected_faces: List["DetectedFace"] = ([] if detected_faces is None
                                                      else detected_faces)
 </s> add         self._image: np.ndarray | None = image
        self._image_shape = T.cast(tuple[int, int, int], image.shape)
        self._detected_faces: list[DetectedFace] = ([] if detected_faces is None
                                                    else detected_faces) </s> remove         vcmd = (self.frame.register(validate))
 </s> add         vcmd = self.frame.register(validate) </s> remove                  image: "np.ndarray",
                 detected_faces: Optional[List["DetectedFace"]] = None,
 </s> add                  image: np.ndarray,
                 detected_faces: list[DetectedFace] | None = None,
        visible = move_axis()[1] - move_axis()[0]
          event: :class:`tkinter.Event`
              The key press event
          """
          move_axis = self._canvas.xview if event.keysym in ("Left", "Right") else self._canvas.yview
        visible = move_axis()[1] - move_axis()[0]
          amount = -visible / 25 if event.keysym in ("Up", "Left") else visible / 25
          logger.trace("Key move event: (event: %s, move_axis: %s, visible: %s, "  # type: ignore
                       "amount: %s)", move_axis, visible, amount)
          move_axis(tk.MOVETO, min(1.0, max(0.0, move_axis()[0] + amount)))
  
keep keep keep keep replace keep keep keep keep keep
 Rebase code (#1326)

* Remove tensorflow_probability requirement

* setup.py - fix progress bars

* requirements.txt: Remove pre python 3.9 packages

* update apple requirements.txt

* update INSTALL.md

* Remove python<3.9 code

* setup.py - fix Windows Installer

* typing: python3.9 compliant

* Update pytest and readthedocs python versions

* typing fixes

* Python Version updates
  - Reduce max version to 3.10
  - Default to 3.10 in installers
  - Remove incompatible 3.11 tests

* Update dependencies

* Downgrade imageio dep for Windows

* typing: merge optional unions and fixes

* Updates
  - min python version 3.10
  - typing to python 3.10 spec
  - remove pre-tf2.10 code
  - Add conda tests

* train: re-enable optimizer saving

* Update dockerfiles

* Update setup.py
  - Apple Conda deps to setup.py
  - Better Cuda + dependency handling

* bugfix: Patch logging to prevent Autograph errors

* Update dockerfiles

* Setup.py - Setup.py - stdout to utf-8

* Add more OSes to github Actions

* suppress mac-os end to end test 
lib/training/preview_tk.py