File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
vertexai/generative_models Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -38,18 +38,15 @@ print(model.generate_content("Why is sky blue?"))
38
38
#### Using images and videos
39
39
``` python
40
40
from vertexai.preview.generative_models import GenerativeModel, Image
41
- print ( vision_model = GenerativeModel(" gemini-pro-vision" ) )
41
+ vision_model = GenerativeModel(" gemini-pro-vision" )
42
42
43
43
# Local image
44
44
image = Image.load_from_file(" image.jpg" )
45
- print (vision_model.generate_content(image))
45
+ print (vision_model.generate_content([ " What is shown in this image? " , image] ))
46
46
47
47
# Image from Cloud Storage
48
48
image_part = generative_models.Part.from_uri(" gs://download.tensorflow.org/example_images/320px-Felis_catus-cat_on_snow.jpg" , mime_type = " image/jpeg" )
49
- print (vision_model.generate_content(image_part))
50
-
51
- # Text and image
52
- print (vision_model.generate_content([" What is shown in this image?" , image]))
49
+ print (vision_model.generate_content([image_part, " Describe this image?" ]))
53
50
54
51
# Text and video
55
52
video_part = Part.from_uri(" gs://cloud-samples-data/video/animals.mp4" , mime_type = " video/mp4" )
You can’t perform that action at this time.
0 commit comments