Skip to content

Commit

Permalink
convert caption prompt to bool (GoogleCloudPlatform#3422)
Browse files Browse the repository at this point in the history
Co-authored-by: Rayan Dasoriya <dasoriya@google.com>
  • Loading branch information
rayandasoriya and Rayan Dasoriya authored Aug 13, 2024
1 parent 78276da commit cdca4a3
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand All @@ -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)
Expand Down

0 comments on commit cdca4a3

Please sign in to comment.