File size: 676 Bytes
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 = "path_to_your_sketch_image.jpg"  # Replace with your image path
base64_image = encode_image_to_base64(image_path)
text_query = "A pink flower"

# Create payload
payload = {
    "image": base64_image,
    "text": text_query
}

# Run the handler
response = handler(payload)

# Show results
print("Fused Embedding:", response)