| # 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) | |