Skip to content

Commit eff0040

Browse files
authored
feat: nano banana pro model (#13641)
1 parent d3c7155 commit eff0040

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

genai/image_generation/imggen_mmflash_edit_img_with_txt_img.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def generate_content() -> str:
2626
image = Image.open("test_resources/example-image-eiffel-tower.png")
2727

2828
response = client.models.generate_content(
29-
model="gemini-2.5-flash-image",
29+
model="gemini-3-pro-image-preview",
3030
contents=[image, "Edit this image to make it look like a cartoon."],
3131
config=GenerateContentConfig(response_modalities=[Modality.TEXT, Modality.IMAGE]),
3232
)
@@ -36,12 +36,7 @@ def generate_content() -> str:
3636
elif part.inline_data:
3737
image = Image.open(BytesIO((part.inline_data.data)))
3838
image.save("output_folder/bw-example-image.png")
39-
# Example response:
40-
# Here's the cartoon-style edit of the image:
41-
# Cartoon-style edit:
42-
# - Simplified the Eiffel Tower with bolder lines and slightly exaggerated proportions.
43-
# - Brightened and saturated the colors of the sky, fireworks, and foliage for a more vibrant, cartoonish look.
44-
# ....
39+
4540
# [END googlegenaisdk_imggen_mmflash_edit_img_with_txt_img]
4641
return "output_folder/bw-example-image.png"
4742

genai/image_generation/imggen_mmflash_txt_and_img_with_txt.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def generate_content() -> int:
2323
client = genai.Client()
2424

2525
response = client.models.generate_content(
26-
model="gemini-2.5-flash-image",
26+
model="gemini-3-pro-image-preview",
2727
contents=(
2828
"Generate an illustrated recipe for a paella."
2929
"Create images to go alongside the text as you generate the recipe"
@@ -38,9 +38,7 @@ def generate_content() -> int:
3838
image = Image.open(BytesIO((part.inline_data.data)))
3939
image.save(f"output_folder/example-image-{i+1}.png")
4040
fp.write(f"![image](example-image-{i+1}.png)")
41-
# Example response:
42-
# A markdown page for a Paella recipe(`paella-recipe.md`) has been generated.
43-
# It includes detailed steps and several images illustrating the cooking process.
41+
4442
# [END googlegenaisdk_imggen_mmflash_txt_and_img_with_txt]
4543
return True
4644

genai/image_generation/imggen_mmflash_with_txt.py

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,10 @@ def generate_content() -> str:
2323
client = genai.Client()
2424

2525
response = client.models.generate_content(
26-
model="gemini-2.5-flash-image",
26+
model="gemini-3-pro-image-preview",
2727
contents=("Generate an image of the Eiffel tower with fireworks in the background."),
2828
config=GenerateContentConfig(
2929
response_modalities=[Modality.TEXT, Modality.IMAGE],
30-
candidate_count=1,
31-
safety_settings=[
32-
{"method": "PROBABILITY"},
33-
{"category": "HARM_CATEGORY_DANGEROUS_CONTENT"},
34-
{"threshold": "BLOCK_MEDIUM_AND_ABOVE"},
35-
],
3630
),
3731
)
3832
for part in response.candidates[0].content.parts:
@@ -41,11 +35,7 @@ def generate_content() -> str:
4135
elif part.inline_data:
4236
image = Image.open(BytesIO((part.inline_data.data)))
4337
image.save("output_folder/example-image-eiffel-tower.png")
44-
# Example response:
45-
# I will generate an image of the Eiffel Tower at night, with a vibrant display of
46-
# colorful fireworks exploding in the dark sky behind it. The tower will be
47-
# illuminated, standing tall as the focal point of the scene, with the bursts of
48-
# light from the fireworks creating a festive atmosphere.
38+
4939
# [END googlegenaisdk_imggen_mmflash_with_txt]
5040
return True
5141

0 commit comments

Comments
 (0)