| from handler import EndpointHandler | |
| import base64 | |
| # Helper function to encode an image to Base64 | |
| def encode_image_to_base64(image_path): | |
| with open(image_path, "rb") as image_file: | |
| return base64.b64encode(image_file.read()).decode("utf-8") | |
| # Initialize the handler | |
| handler = EndpointHandler(path=".") | |
| # Prepare sample inputs | |
| image_path = "sketches/COCO_val2014_000000163852.jpg" | |
| base64_image = encode_image_to_base64(image_path) | |
| text_query = "A pink flower" | |
| # Create payload | |
| payload = { | |
| "sketch": base64_image, | |
| "text": text_query | |
| } | |
| # Run the handler | |
| response = handler(payload) | |
| # Show results | |
| print("Fused Embedding:", response) | |