Skip to content

Commit e521e1a

Browse files
author
Guiners
committed
fixing failed tests
1 parent c1a6add commit e521e1a

File tree

4 files changed

+38
-20
lines changed

4 files changed

+38
-20
lines changed

genai/image-generation/imggen-canny-ctrl-type-with-txt-img.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ async function generateImage(
4646

4747
const response = await client.models.editImage({
4848
model: 'imagen-3.0-capability-001',
49+
// The '[1]' in the prompt corresponds to the controlReferenceImage.referenceId above.
4950
prompt: 'a watercolor painting of a red car[1] driving on a road',
5051
referenceImages: [controlReferenceImage],
5152
config: {

genai/image-generation/imggen-subj-refer-ctrl-refer-with-txt-imgs.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ async function generateImage(
6060

6161
const response = await client.models.editImage({
6262
model: 'imagen-3.0-capability-001',
63-
prompt:
64-
`a portrait of a woman[1] in the pose of the control image[2]in a watercolor style by a professional artist,
63+
prompt: `a portrait of a woman[1] in the pose of the control image[2]in a watercolor style by a professional artist,
6564
light and low-contrast stokes, bright pastel colors, a warm atmosphere, clean background, grainy paper,
6665
bold visible brushstrokes, patchy details`,
6766
referenceImages: [subjectReferenceImage, controlReferenceImage],

genai/test/imggen-raw-reference-with-txt-img.test.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,24 @@ const {delay} = require('./util');
2424
const {createOutputGcsUri} = require('./imggen-util');
2525
describe('imggen-raw-reference-with-txt-img', () => {
2626
it('should return an array of generated image URIs', async function () {
27-
this.timeout(180000);
28-
this.retries(4);
27+
this.timeout(600000);
28+
this.retries(3);
29+
2930
const output = await createOutputGcsUri();
30-
console.log(output.uri);
31-
await delay(this.test);
32-
const generatedFileNames = await sample.generateImage(
33-
output.uri,
34-
projectId
35-
);
36-
assert(generatedFileNames.length > 0);
31+
console.log('Output GCS URI:', output.uri);
32+
33+
try {
34+
await delay(this.test);
35+
const generatedFileNames = await sample.generateImage(
36+
output.uri,
37+
projectId
38+
);
39+
console.log('Generated files:', generatedFileNames);
40+
41+
assert(generatedFileNames.length > 0);
42+
} catch (err) {
43+
console.error('Image generation failed:', err);
44+
throw err;
45+
}
3746
});
3847
});

genai/test/imggen-scribble-ctrl-type-with-txt-img.test.js

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,24 @@ const {createOutputGcsUri} = require('./imggen-util');
2424

2525
describe('imggen-scribble-ctrl-type-with-txt-img', async () => {
2626
it('should generate images from a text prompt with control reference image', async function () {
27-
this.timeout(180000);
28-
this.retries(4);
27+
this.timeout(600000);
28+
this.retries(3);
29+
2930
const output = await createOutputGcsUri();
30-
console.log(output.uri);
31-
await delay(this.test);
32-
const generatedFileNames = await sample.generateImage(
33-
output.uri,
34-
projectId
35-
);
36-
assert(generatedFileNames.length > 0);
31+
console.log('Output GCS URI:', output.uri);
32+
33+
try {
34+
await delay(this.test);
35+
const generatedFileNames = await sample.generateImage(
36+
output.uri,
37+
projectId
38+
);
39+
console.log('Generated files:', generatedFileNames);
40+
41+
assert(generatedFileNames.length > 0);
42+
} catch (err) {
43+
console.error('Image generation failed:', err);
44+
throw err;
45+
}
3746
});
3847
});

0 commit comments

Comments
 (0)