blip / test_handler.py
saisriteja's picture
Initial commit for checking the handler for the blip model
192a99b verified
raw
history blame contribute delete
770 Bytes
# Import and initialize the handler
from handler import EndpointHandler
# Initialize the handler
my_handler = EndpointHandler()
# Sample payload for conditional captioning
conditional_payload = {
"image_url": "https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg",
"prompt": "a photography of"
}
# Sample payload for unconditional captioning
unconditional_payload = {
"image_url": "https://storage.googleapis.com/sfr-vision-language-research/BLIP/demo.jpg"
}
# Run the handler for both cases and print the outputs
conditional_caption = my_handler(conditional_payload)
unconditional_caption = my_handler(unconditional_payload)
print("Conditional Caption:", conditional_caption)
print("Unconditional Caption:", unconditional_caption)