File tree Expand file tree Collapse file tree 2 files changed +4
-5
lines changed
Expand file tree Collapse file tree 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):
251251 actual_parameters = predict_kwargs ["parameters" ]
252252 actual_instance = predict_kwargs ["instances" ][0 ]
253253 assert actual_instance ["prompt" ] == prompt1
254- assert actual_instance ["negativePrompt" ] == negative_prompt1
254+ assert actual_parameters ["negativePrompt" ] == negative_prompt1
255255 # TODO(b/295946075) The service stopped supporting image sizes.
256256 # assert actual_parameters["sampleImageSize"] == str(max(width, height))
257257 # assert actual_parameters["aspectRatio"] == f"{width}:{height}"
Original file line number Diff line number Diff line change @@ -174,10 +174,6 @@ def _generate_images(
174174 "number_of_images_in_batch" : number_of_images ,
175175 }
176176
177- if negative_prompt :
178- instance ["negativePrompt" ] = negative_prompt
179- shared_generation_parameters ["negative_prompt" ] = negative_prompt
180-
181177 if base_image :
182178 base_image_base64 = (
183179 base_image ._as_base64_string ()
@@ -207,6 +203,9 @@ def _generate_images(
207203 parameters ["aspectRatio" ] = f"{ width } :{ height } "
208204
209205 parameters ["sampleCount" ] = number_of_images
206+ if negative_prompt :
207+ parameters ["negativePrompt" ] = negative_prompt
208+ shared_generation_parameters ["negative_prompt" ] = negative_prompt
210209
211210 if seed is not None :
212211 # Note: String seed and numerical seed give different results
You can’t perform that action at this time.
0 commit comments