File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -99,10 +99,21 @@ def test_text_gen_multimodal_audio(self):
99
99
100
100
def test_text_gen_multimodal_video_prompt (self ):
101
101
# [START text_gen_multimodal_video_prompt]
102
+ import time
103
+
104
+ # Video clip (CC BY 3.0) from https://peach.blender.org/download/
105
+ myfile = genai .upload_file (media / "Big_Buck_Bunny.mp4" )
106
+ print (f"{ myfile = } " )
107
+
108
+ # Videos need to be processed before you can use them.
109
+ while myfile .state .name == "PROCESSING" :
110
+ print ("processing video..." )
111
+ time .sleep (5 )
112
+ myfile = genai .get_file (myfile .name )
113
+
102
114
model = genai .GenerativeModel ("gemini-1.5-flash" )
103
- video = genai .upload_file (media / "Big_Buck_Bunny.mp4" )
104
- response = model .generate_content (["Describe this video clip." , video ])
105
- print (response .text )
115
+ result = model .generate_content ([myfile , "Describe this video clip" ])
116
+ print (f"{ result .text = } " )
106
117
# [END text_gen_multimodal_video_prompt]
107
118
108
119
def test_text_gen_multimodal_video_prompt_streaming (self ):
You can’t perform that action at this time.
0 commit comments