Skip to content

Commit 8b007d0

Browse files
authored
fix: update vto and product recontext params (#2431)
1 parent fac838b commit 8b007d0

File tree

2 files changed

+15
-27
lines changed

2 files changed

+15
-27
lines changed

vision/getting-started/imagen_product_recontext.ipynb

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@
375375
"\n",
376376
"In each call, you can specify the following parameters in addition to `product_images`:\n",
377377
" - **Prompt:** Describe the setting you'd like the product to appear in.\n",
378-
" - **Base steps:** This integer controls image generation. Higher values increase quality but also increase latency.\n",
378+
" - **Enhance Prompt:** This model offers the option to enhance your provided prompt, which is enabled by default. If you'd like to disable this feature, set `enhance_prompt` to False.\n",
379379
" - **Number of images:** 1 - 4"
380380
]
381381
},
@@ -398,10 +398,10 @@
398398
" ],\n",
399399
" ),\n",
400400
" config=RecontextImageConfig(\n",
401-
" base_steps=32,\n",
401+
" enhance_prompt=True,\n",
402+
" output_mime_type=\"image/jpeg\",\n",
402403
" number_of_images=1,\n",
403404
" safety_filter_level=\"BLOCK_LOW_AND_ABOVE\",\n",
404-
" person_generation=\"ALLOW_ADULT\",\n",
405405
" ),\n",
406406
")\n",
407407
"\n",
@@ -417,12 +417,8 @@
417417
"You can also recontextualize products without setting a `prompt` in the request. The model will generate an appropriate background based on the product image.\n",
418418
"\n",
419419
"\n",
420-
"When generating images with people you can also set the `safety_filter_level` and `person_generation` parameters accordingly:\n",
420+
"When generating images you can also set the `safety_filter_level` accordingly:\n",
421421
"\n",
422-
"- `person_generation`\n",
423-
" - `DONT_ALLOW`\n",
424-
" - `ALLOW_ADULT`\n",
425-
" - `ALLOW_ALL`\n",
426422
"- `safety_filter_level`\n",
427423
" - `BLOCK_LOW_AND_ABOVE`\n",
428424
" - `BLOCK_MEDIUM_AND_ABOVE`\n",
@@ -446,10 +442,9 @@
446442
" ],\n",
447443
" ),\n",
448444
" config=RecontextImageConfig(\n",
449-
" base_steps=32,\n",
445+
" output_mime_type=\"image/jpeg\",\n",
450446
" number_of_images=1,\n",
451447
" safety_filter_level=\"BLOCK_LOW_AND_ABOVE\",\n",
452-
" person_generation=\"ALLOW_ADULT\",\n",
453448
" ),\n",
454449
")\n",
455450
"\n",
@@ -519,8 +514,10 @@
519514
},
520515
"outputs": [],
521516
"source": [
517+
"# fmt: off\n",
522518
"prompt = \"on a running track\" # @param {type: 'string'}\n",
523519
"gcs_uri = \"gs://cloud-samples-data/generative-ai/image/shoes.jpg\" # @param {type: 'string'}\n",
520+
"# fmt: on\n",
524521
"\n",
525522
"\n",
526523
"response = client.models.recontext_image(\n",
@@ -530,10 +527,10 @@
530527
" product_images=[ProductImage(product_image=Image(gcs_uri=gcs_uri))],\n",
531528
" ),\n",
532529
" config=RecontextImageConfig(\n",
533-
" base_steps=32,\n",
530+
" output_mime_type=\"image/jpeg\",\n",
531+
" enhance_prompt=True,\n",
534532
" number_of_images=1,\n",
535533
" safety_filter_level=\"BLOCK_LOW_AND_ABOVE\",\n",
536-
" person_generation=\"ALLOW_ADULT\",\n",
537534
" ),\n",
538535
")\n",
539536
"\n",

vision/getting-started/virtual_try_on.ipynb

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"- Try-on multiple clothing items from locally stored images\n",
109109
"- Try-on a clothing item in Cloud Storage with an Imagen generated person\n",
110110
"\n",
111-
"Learn more about [quotas](https://cloud.google.com/vertex-ai/generative-ai/docs/models/imagen/virtual-try-on-preview-08-04) and [pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing#imagen-models) for Virtual Try-On in the product documentation. "
111+
"Learn more about [quotas](https://cloud.google.com/vertex-ai/generative-ai/docs/models/imagen/virtual-try-on-preview-08-04) and [pricing](https://cloud.google.com/vertex-ai/generative-ai/pricing#imagen-models) for Virtual Try-On in the product documentation."
112112
]
113113
},
114114
{
@@ -418,7 +418,6 @@
418418
"### Send the request\n",
419419
"\n",
420420
"With the Virtual Try-On model, you can only specify one clothing item to try on at a time. Since this example has two clothing items, you'll need to make two separate requests. In each call, you can specify the following parameters in addition to the `person_image` and `product_images`:\n",
421-
" - **Base steps:** An integer that controls image generation, with higher steps trading higher quality for increased latency.\n",
422421
" - **Number of images:** 1 - 4\n",
423422
"\n",
424423
"You'll save the output image locally so that it can be referenced in the next step."
@@ -441,10 +440,9 @@
441440
" ],\n",
442441
" ),\n",
443442
" config=RecontextImageConfig(\n",
444-
" base_steps=32,\n",
443+
" output_mime_type=\"image/jpeg\",\n",
445444
" number_of_images=1,\n",
446445
" safety_filter_level=\"BLOCK_LOW_AND_ABOVE\",\n",
447-
" person_generation=\"ALLOW_ADULT\",\n",
448446
" ),\n",
449447
")\n",
450448
"\n",
@@ -458,12 +456,7 @@
458456
"id": "cP_gkDUVx-3Z"
459457
},
460458
"source": [
461-
"When generating images of people you can also set the `safety_filter_level` and `person_generation` parameters accordingly:\n",
462-
"\n",
463-
"- `person_generation`\n",
464-
" - `DONT_ALLOW`\n",
465-
" - `ALLOW_ADULT`\n",
466-
" - `ALLOW_ALL`\n",
459+
"When generating images you can also set the `safety_filter_level` parameter accordingly:\n",
467460
"- `safety_filter_level`\n",
468461
" - `BLOCK_LOW_AND_ABOVE`\n",
469462
" - `BLOCK_MEDIUM_AND_ABOVE`\n",
@@ -488,10 +481,9 @@
488481
" ],\n",
489482
" ),\n",
490483
" config=RecontextImageConfig(\n",
491-
" base_steps=32,\n",
484+
" output_mime_type=\"image/jpeg\",\n",
492485
" number_of_images=1,\n",
493486
" safety_filter_level=\"BLOCK_LOW_AND_ABOVE\",\n",
494-
" person_generation=\"ALLOW_ADULT\",\n",
495487
" ),\n",
496488
")\n",
497489
"display_image(response.generated_images[0].image)"
@@ -535,10 +527,10 @@
535527
" model=image_generation,\n",
536528
" prompt=prompt,\n",
537529
" config=GenerateImagesConfig(\n",
530+
" output_mime_type=\"image/jpeg\",\n",
538531
" number_of_images=1,\n",
539532
" image_size=\"2K\",\n",
540533
" safety_filter_level=\"BLOCK_MEDIUM_AND_ABOVE\",\n",
541-
" person_generation=\"ALLOW_ADULT\",\n",
542534
" ),\n",
543535
")\n",
544536
"display_image(image.generated_images[0].image)"
@@ -609,10 +601,9 @@
609601
" ],\n",
610602
" ),\n",
611603
" config=RecontextImageConfig(\n",
612-
" base_steps=32,\n",
604+
" output_mime_type=\"image/jpeg\",\n",
613605
" number_of_images=1,\n",
614606
" safety_filter_level=\"BLOCK_LOW_AND_ABOVE\",\n",
615-
" person_generation=\"ALLOW_ADULT\",\n",
616607
" ),\n",
617608
")\n",
618609
"display_image(response.generated_images[0].image)"

0 commit comments

Comments
 (0)