File tree Expand file tree Collapse file tree 1 file changed +6
-12
lines changed
google/generativeai/types Expand file tree Collapse file tree 1 file changed +6
-12
lines changed Original file line number Diff line number Diff line change 37
37
IMAGE_TYPES = (PIL .Image .Image , IPython .display .Image )
38
38
ImageType = PIL .Image .Image | IPython .display .Image
39
39
else :
40
+ IMAGE_TYPES = ()
40
41
try :
41
42
import PIL .Image
42
43
import PIL .ImageFile
44
+
45
+ IMAGE_TYPES = IMAGE_TYPES + (PIL .Image .Image ,)
43
46
except ImportError :
44
47
PIL = None
45
48
46
49
try :
47
50
import IPython .display
51
+
52
+ IMAGE_TYPES = IMAGE_TYPES + (IPython .display .Image ,)
48
53
except ImportError :
49
54
IPython = None
50
55
51
- if PIL is not None and IPython is not None :
52
- IMAGE_TYPES = (PIL .Image .Image , IPython .display .Image )
53
- ImageType = Union [PIL .Image .Image , IPython .display .Image ]
54
- elif PIL is not None and IPython is None :
55
- IMAGE_TYPES = (PIL .Image .Image ,)
56
- ImageType = Union [PIL .Image .Image ]
57
- elif PIL is None and IPython is not None :
58
- IMAGE_TYPES = (IPython .display .Image ,)
59
- ImageType = Union [IPython .display .Image ,]
60
- else :
61
- IMAGE_TYPES = ()
62
- ImageType = Union
56
+ ImageType = Union ["PIL.Image.Image" , "IPython.display.Image" ]
63
57
64
58
65
59
__all__ = [
You can’t perform that action at this time.
0 commit comments