Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion genai/text_generation/textgen_with_local_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def generate_content() -> str:
response = client.models.generate_content(
model=model_id,
contents=[
"Write a short and engaging blog post based on this video.",
Part.from_bytes(data=video_content, mime_type="video/mp4"),
"Write a short and engaging blog post based on this video.",
],
)

Expand Down
2 changes: 1 addition & 1 deletion genai/text_generation/textgen_with_mute_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ def generate_content() -> str:
response = client.models.generate_content(
model="gemini-2.0-flash-001",
contents=[
"What is in the video?",
Part.from_uri(
file_uri="gs://cloud-samples-data/generative-ai/video/ad_copy_from_video.mp4",
mime_type="video/mp4",
),
"What is in the video?",
],
)
print(response.text)
Expand Down
2 changes: 1 addition & 1 deletion genai/text_generation/textgen_with_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def generate_content() -> str:
response = client.models.generate_content(
model="gemini-2.0-flash-001",
contents=[
prompt,
Part.from_uri(
file_uri="gs://cloud-samples-data/generative-ai/video/pixel8.mp4",
mime_type="video/mp4",
),
prompt,
],
)

Expand Down
11 changes: 4 additions & 7 deletions genai/text_generation/textgen_with_youtube_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,13 @@ def generate_content() -> str:
client = genai.Client(http_options=HttpOptions(api_version="v1"))
model_id = "gemini-2.0-flash-001"

# You can include text, PDF documents, images, audio and video in your prompt requests and get text or code responses.
video = Part.from_uri(
file_uri="https://www.youtube.com/watch?v=3KtWfp0UopM",
mime_type="video/mp4",
)

response = client.models.generate_content(
model=model_id,
contents=[
video,
Part.from_uri(
file_uri="https://www.youtube.com/watch?v=3KtWfp0UopM",
mime_type="video/mp4",
),
"Write a short and engaging blog post based on this video.",
],
)
Expand Down