Skip to content

Commit 13c728f

Browse files
author
Guiners
committed
fixing failed tests
1 parent 1538967 commit 13c728f

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

genai/image-generation/imggen-mmflash-edit-img-with-txt-img.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,26 @@ async function generateImage(
3434
location: location,
3535
});
3636

37-
const image = fs.readFileSync(FILE_NAME);
37+
const imageBytes = fs.readFileSync(FILE_NAME);
3838

3939
const response = await client.models.generateContent({
4040
model: 'gemini-2.5-flash-image',
41-
contents: [image, 'Edit this image to make it look like a cartoon'],
41+
contents: [
42+
{
43+
role: 'user',
44+
parts: [
45+
{
46+
inlineData: {
47+
mimeType: 'image/png',
48+
data: imageBytes.toString('base64'),
49+
},
50+
},
51+
{
52+
text: 'Edit this image to make it look like a cartoon',
53+
},
54+
],
55+
},
56+
],
4257
config: {
4358
responseModalities: [Modality.TEXT, Modality.IMAGE],
4459
},

0 commit comments

Comments
 (0)