File tree 3 files changed +31
-2
lines changed
3 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 22
22
23
23
from google .cloud import aiplatform
24
24
from tests .system .aiplatform import e2e_base
25
+ from vertexai import vision_models as ga_vision_models
25
26
from vertexai .preview import vision_models
26
27
from PIL import Image as PIL_Image
27
28
@@ -45,7 +46,7 @@ class VisionModelTestSuite(e2e_base.TestEndToEnd):
45
46
def test_image_captioning_model_get_captions (self ):
46
47
aiplatform .init (project = e2e_base ._PROJECT , location = e2e_base ._LOCATION )
47
48
48
- model = vision_models .ImageCaptioningModel .from_pretrained ("imagetext" )
49
+ model = ga_vision_models .ImageCaptioningModel .from_pretrained ("imagetext" )
49
50
image = _create_blank_image ()
50
51
captions = model .get_captions (
51
52
image = image ,
Original file line number Diff line number Diff line change 35
35
from google .cloud .aiplatform .compat .types import (
36
36
publisher_model as gca_publisher_model ,
37
37
)
38
+ from vertexai import vision_models as ga_vision_models
38
39
from vertexai .preview import vision_models
39
40
40
41
from PIL import Image as PIL_Image
@@ -102,7 +103,9 @@ def test_get_captions(self):
102
103
attribute = "get_publisher_model" ,
103
104
return_value = gca_publisher_model (_IMAGE_TEXT_PUBLISHER_MODEL_DICT ),
104
105
):
105
- model = vision_models .ImageCaptioningModel .from_pretrained ("imagetext@001" )
106
+ model = ga_vision_models .ImageCaptioningModel .from_pretrained (
107
+ "imagetext@001"
108
+ )
106
109
107
110
image_captions = [
108
111
"Caption 1" ,
Original file line number Diff line number Diff line change
1
+ # Copyright 2023 Google LLC
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+ #
15
+ """Classes for working with vision models."""
16
+
17
+ from vertexai .vision_models ._vision_models import (
18
+ Image ,
19
+ ImageCaptioningModel ,
20
+ )
21
+
22
+ __all__ = [
23
+ "Image" ,
24
+ "ImageCaptioningModel" ,
25
+ ]
You can’t perform that action at this time.
0 commit comments