Skip to content

Commit

Permalink
Revert "fix lazy loading with typing"
Browse files Browse the repository at this point in the history
This reverts commit 0baabfe.
  • Loading branch information
MarkDaoust committed Sep 27, 2024
1 parent 0baabfe commit 780dc67
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions google/generativeai/vision_models/_vision_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@

try:
from PIL import Image as PIL_Image
from PIL.Image import Image as PILImageClass
except ImportError:
PIL_Image = None
PILImageClass = None


# This is to get around https://github.com/googleapis/proto-plus-python/issues/488
Expand Down Expand Up @@ -113,7 +111,7 @@ class Image:
__module__ = "vertexai.vision_models"

_loaded_bytes: Optional[bytes] = None
_loaded_image: Optional["PILImageClass"] = None
_loaded_image: Optional["PIL_Image.Image"] = None

def __init__(
self,
Expand Down Expand Up @@ -151,7 +149,7 @@ def _image_bytes(self, value: bytes):
self._loaded_bytes = value

@property
def _pil_image(self) -> "PILImageClass":
def _pil_image(self) -> "PIL_Image.Image": # type: ignore
if self._loaded_image is None:
if not PIL_Image:
raise RuntimeError(
Expand Down

0 comments on commit 780dc67

Please sign in to comment.