File size: 654 Bytes
b6ff56b 8d4eb6b b6ff56b 8d4eb6b b6ff56b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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)
|