File tree 2 files changed +4
-5
lines changed
2 files changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ def test_generate_images(self):
251
251
actual_parameters = predict_kwargs ["parameters" ]
252
252
actual_instance = predict_kwargs ["instances" ][0 ]
253
253
assert actual_instance ["prompt" ] == prompt1
254
- assert actual_instance ["negativePrompt" ] == negative_prompt1
254
+ assert actual_parameters ["negativePrompt" ] == negative_prompt1
255
255
# TODO(b/295946075) The service stopped supporting image sizes.
256
256
# assert actual_parameters["sampleImageSize"] == str(max(width, height))
257
257
# assert actual_parameters["aspectRatio"] == f"{width}:{height}"
Original file line number Diff line number Diff line change @@ -174,10 +174,6 @@ def _generate_images(
174
174
"number_of_images_in_batch" : number_of_images ,
175
175
}
176
176
177
- if negative_prompt :
178
- instance ["negativePrompt" ] = negative_prompt
179
- shared_generation_parameters ["negative_prompt" ] = negative_prompt
180
-
181
177
if base_image :
182
178
base_image_base64 = (
183
179
base_image ._as_base64_string ()
@@ -207,6 +203,9 @@ def _generate_images(
207
203
parameters ["aspectRatio" ] = f"{ width } :{ height } "
208
204
209
205
parameters ["sampleCount" ] = number_of_images
206
+ if negative_prompt :
207
+ parameters ["negativePrompt" ] = negative_prompt
208
+ shared_generation_parameters ["negative_prompt" ] = negative_prompt
210
209
211
210
if seed is not None :
212
211
# Note: String seed and numerical seed give different results
You can’t perform that action at this time.
0 commit comments