From cdca4a3c2e0178ceb20e9143e0166cdb160cc278 Mon Sep 17 00:00:00 2001 From: Rayan Dasoriya Date: Wed, 14 Aug 2024 02:43:56 +0530 Subject: [PATCH] convert caption prompt to bool (#3422) Co-authored-by: Rayan Dasoriya --- .../model_oss/notebook_util/common_util.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/community-content/vertex_model_garden/model_oss/notebook_util/common_util.py b/community-content/vertex_model_garden/model_oss/notebook_util/common_util.py index ba7591f2f..05b392be7 100644 --- a/community-content/vertex_model_garden/model_oss/notebook_util/common_util.py +++ b/community-content/vertex_model_garden/model_oss/notebook_util/common_util.py @@ -360,9 +360,9 @@ def vqa_predict( def caption_predict( endpoint: Any, - caption_prompt: str, language_code: str, image: Any, + caption_prompt: bool = False, new_width: int = 1000, ) -> str: """Predicts a caption for a given image using an Endpoint.""" @@ -374,10 +374,8 @@ def caption_predict( if caption_prompt: # Format caption prompt - caption_prompt_format = "caption {} {}\n" - instance["prompt"] = caption_prompt_format.format( - language_code, caption_prompt - ) + caption_prompt_format = "caption {}\n" + instance["prompt"] = caption_prompt_format.format(language_code) instances = [instance] response = endpoint.predict(instances=instances)