File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
google/generativeai/types Expand file tree Collapse file tree 1 file changed +12
-6
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 = ()
41
40
try :
42
41
import PIL .Image
43
42
import PIL .ImageFile
44
-
45
- IMAGE_TYPES = IMAGE_TYPES + (PIL .Image .Image ,)
46
43
except ImportError :
47
44
PIL = None
48
45
49
46
try :
50
47
import IPython .display
51
-
52
- IMAGE_TYPES = IMAGE_TYPES + (IPython .display .Image ,)
53
48
except ImportError :
54
49
IPython = None
55
50
56
- ImageType = Union [* IMAGE_TYPES ]
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
57
63
58
64
59
65
__all__ = [
You can’t perform that action at this time.
0 commit comments