File size: 768 Bytes
865795a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from handler import EndpointHandler
from PIL import Image

# init handler
my_handler = EndpointHandler(path=".")

# prepare sample payload
reg_payload = {"inputs": "An astronaut riding a horse on the moon, <comic-strip> style"}
neg_payload = {"inputs": "A strawberry on the beach, <comic-strip> style", "negative_prompt": "black and white"}
multi_payload = {"inputs": ["A strawberry on the beach, <comic-strip> style", "An astronaut riding a horse on the moon, <comic-strip> style"], "negative_prompt": "black and white"}

# test the handler
reg_payload_pred=my_handler(reg_payload)
neg_payload_pred=my_handler(neg_payload)
multi_payload_pred=my_handler(multi_payload)

reg_payload_pred[0].save("reg_payload_pred.png")
neg_payload_pred[0].save("neg_payload_pred.png")