Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Check video status. #442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions samples/text_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,21 @@ def test_text_gen_multimodal_audio(self):

def test_text_gen_multimodal_video_prompt(self):
# [START text_gen_multimodal_video_prompt]
import time

# Video clip (CC BY 3.0) from https://peach.blender.org/download/
myfile = genai.upload_file(media / "Big_Buck_Bunny.mp4")
print(f"{myfile=}")

# Videos need to be processed before you can use them.
while myfile.state.name == "PROCESSING":
print("processing video...")
time.sleep(5)
myfile = genai.get_file(myfile.name)

model = genai.GenerativeModel("gemini-1.5-flash")
video = genai.upload_file(media / "Big_Buck_Bunny.mp4")
response = model.generate_content(["Describe this video clip.", video])
print(response.text)
result = model.generate_content([myfile, "Describe this video clip"])
print(f"{result.text=}")
# [END text_gen_multimodal_video_prompt]

def test_text_gen_multimodal_video_prompt_streaming(self):
Expand Down
Loading